• Resolved edie

    (@edie)


    I’d like to show how many results there were in a search. For example I’d like it to say:

    There were 5 posts containing the word “whatever”.

    Thanks to anyone who can help with this :o)

Viewing 10 replies - 1 through 10 (of 10 total)
  • what version of wordpress are you using?

    https://www.village-idiot.org/archives/2007/05/26/search-results-count-plugin/

    Thats the link to the fixed plugin for WP2.2 that does that.. the link to the original, which will probably work in earlier versions is linked inside that post.

    Please note — that is NOT my plugin. I just fixed it for 2.2 compatibility.

    Thread Starter edie

    (@edie)

    Awesome thank you so much. I guess Im an airhead, but how do I call it? Ive tried everything. I dont know much about PHP.

    yeah, I thought that might come up ?? Again, not my plugin, and amazingly the author didnt include a readme or anything.

    Its simple though actually.

    Wherever you want the display, add this:

    <?php wp_searchheader(); ?>

    Thread Starter edie

    (@edie)

    Thanks. Works perfectly ??

    Fantastic!!! This is so simple and so amazing.

    Ah but I’m having issues… The Search Results plugin work very well except when displaying more than 5 results. When I search for the word “the” I get this…

    “Showing results 1 – 5 of 5 for the search terms: the.”

    and then

    “Showing results 6 – 5 of 5 for the search terms: the.”

    for the next page and so on. I took a look at the plugin code but PHP confounds me. Is there something wrong with the plugin or is it just me?

    Oh and I’m getting this whenever I edit my search.php page or activate/deactivate plugins I get this error…

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/a/l/r/alronhauser/html/wp-content/plugins/resultscount.php:67) in /home/content/a/l/r/alronhauser/html/wp-admin/theme-editor.php on line 55

    I’m so sad cause I thought this was such a great plugin.

    Oh, my site is TwoWordHeap.com

    The problem :

    Warning: Cannot modify header information – headers already sent by (output started at

    can be fixed if you delete the blank character wich follows the

    php>

    at the end of the script

    If this topic still needs an answer, try this. No plug-in required, and deceptively simple. Just add this line of code before your while loop:

    $hit_count = $wp_query->found_posts;

    For example, my search results page looks like this:

    <?php if (have_posts()) : ?>
    
    <?php $hit_count = $wp_query->found_posts; // count # of search results ?>
    <p>Your search for <b>'<?php the_search_query(); ?>'</b> returned <?php echo $hit_count . ' results'; ?></p>

    .
    .
    .
    (while loop, etc.)

    GREAT!!! ??
    Thx for solution …. because this original plugin did not work for me in WP 2.5

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Number Of Results In Search’ is closed to new replies.