Number of results not showing on "Archive"

Forums › Forums › Search & Filter Pro › Number of results not showing on "Archive"

Viewing 3 posts – 1 through 3 (of 3 total)
  • Anonymous
    #108800

    Hi Trevor, I hope you have had a nice weekend.

    Since setting up my code in an “archive” it is working great although when I try to display the number of results with the code from results.php it doesn’t work. I am trying the following code:

    Found <?php echo $query->found_posts; ?> Results<br />

    Which I copied from results.php

    I’m sure it has something to do with “$query” but I have no idea what to replace it with?

    Any ideas on this one?

    Ross Moderator
    #108801

    Hi Tom

    Archive display method uses the global $wp_query object, rather than the local $query.

    So it should be:

    Found <?php 
    global $wp_query;
    echo $wp_query->found_posts; 
    ?> Results<br />

    Thanks

    Anonymous
    #108826

    This works perfectly! Thanks so much!!

Viewing 3 posts – 1 through 3 (of 3 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.