WordPress.org

Ready to get started?Download WordPress

Forums

"Search page" shows blank page if result is not accurate (4 posts)

  1. hildergarn
    Member
    Posted 2 years ago #

    Hi. I'm testing a blog i'm creating and at the moment the search form works ok, but when I search for rubbish words it shows a blank page. Is it possible to tell the search form to display the 404 page?

    Thanks in advance!

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    It would be easier to just add an else conditional to the end of the Loop in search.php along the lines of:

    <?php else : ?>
    <span class="sorry"><?php _e('Sorry - I couldn\'t find anything' ));?></span>');?></p>
    <?php endif; ?>
  3. hildergarn
    Member
    Posted 2 years ago #

    Hi esmi. I tried and the code disabled my search page. Let me show you the code of my search.php page

    [ Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin ]

    If it helps on something I'm using this template. Thanks!

  4. hildergarn
    Member
    Posted 2 years ago #

    Let me show you the code again using pastebin: http://pastebin.com/mBbpz0JT

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags