• Hello,

    I’d like to add a header to my page with search results. It should go like “Search results for” followed by the search string the user is looking for.

    How can I add it?

    Best Regards,

    Joerg

Viewing 8 replies - 1 through 8 (of 8 total)
  • like this?

    http://www.village-idiot.org/search/wordpress

    I wont give away everything I do, but the search term is just

    echo wp_specialchars($s);

    as long as you are on search.php (im pretty sure)

    I use a lot of WordPress voodoo to do what I do.

    Thread Starter eschenfelder

    (@eschenfelder)

    Not exactly.

    The page displays the posts relating to the search just as headers. On top of the lists should be a header like “Search results for <search string>”.
    Eg. if you search for “wordpress march” the resulting page should display all relating posts and display “Search results for ‘wordpress march'”.

    apparantly, you didnt look at the title of that page.

    <title>village-idiot.org - 156 Results for wordpress </title>

    the searched term is WordPress

    Thread Starter eschenfelder

    (@eschenfelder)

    Ok, sorry for that. I am looking for this but like to include this into the archive.php.

    Something like this:

    <?php /* If this is a search */ } elseif (is_search()) { ?>
    
    <h2 class="pagetitle">Search Results< für <? php the_title; ?></h2>

    <? php the_title; ?> isnt going to return what you are asking for. Thats not the search term(s).

    and archive.php doesnt use search terms.

    Thread Starter eschenfelder

    (@eschenfelder)

    Yes. This was just to show how it should look like. How can I get the search terms?

    Isn’t there a hack for this?

    i already told you.

    echo wp_specialchars($s);

    ^^^^^^^^^^^^^^^^^ is your search term

    Thread Starter eschenfelder

    (@eschenfelder)

    Sorry, my fault. Thanks a lot.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Search string for headline’ is closed to new replies.