WordPress.org

Ready to get started?Download WordPress

Forums

Including search terms in results pages (4 posts)

  1. xulu
    Member
    Posted 7 years ago #

    Is there a way to include the search terms on the search results page? For instance, I'd like an empty result to display something along the lines of "No entries were found containing the word(s) XYZ." Is that possible?

  2. whooami
    Member
    Posted 7 years ago #

    sure, the search terms are put into an array named $s_array

    thats as much as info as I can share as I have to leave for work -- Im guessing someone else can elaborate on what you'll need to do with that.

  3. whooami
    Member
    Posted 7 years ago #

    ok, so here is how and its simpler than I imagined; so simple I'm surprised someone else didnt answer this for ya.

    The search terms are one variable, using any search related plugins may change that, obviously.

    So anyway, where the default message is outputted in the event nothing is found just include <?php echo $s; ?> to echo back the searched terms.

    example here:

    http://www.village-idiot.org/search/pookie%20moo

    Ive used a highlite trick just to make it stand out more.

    neat idea, btw.

  4. xulu
    Member
    Posted 7 years ago #

    Thanks a lot! That's exactly what I was looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.