Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is this possible? I have a searchform that searches for certain categories. If there is no post, it will show me a 404 page... Can I change this page to something else? If so, how do I do that?

share|improve this question
    
    
Seems like the actual problem is not the template but the empty search. Just marked it for others to check. –  kaiser Aug 4 '13 at 11:39

1 Answer 1

You can either change the code of your 404.php to conditionally show other stuff with is_search() { ... } or you can use the search.php Template.

share|improve this answer
    
What difference will is_search make? It does not get my category? How do I do that? –  user1627363 Aug 4 '13 at 11:18
    
It's a conditional tag and it allows you to check if you got a search results page. –  kaiser Aug 4 '13 at 11:37
1  
Ah, so the is_search goes in the place where I want a different output? Well then, I guess I have to try that. Thanks. –  user1627363 Aug 4 '13 at 11:41
    
I tried this in 404.php, but it did nothing <?php if (is_search() { echo 'blabla'; });?> What is wrong with this one? –  user1627363 Aug 4 '13 at 15:23
    
Have you read the other Q/A I linked in the comment to your answer? –  kaiser Aug 4 '13 at 16:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.