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)