Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro displaying a search counter

Viewing 6 posts - 1 through 6 (of 6 total)
  • dann hanks
    #80549

    HI,

    I am trying to display a search counter but am coming across a glitch.

    <h3 class="pagetitle">Search for <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">'); echo $key; _e('</span>'); _e(' &mdash; '); echo $count . ' '; _e('resources'); wp_reset_query(); ?></h3>

    is the code I am using at the top of the results page.

    This works but then seems to conflict with the search and filter results. So if I search for ‘easter’ in ‘Category A’ it comes back with:

    “Search for easter — 13 resources”

    then, if I change this search to ‘Category B’, it says the same again:

    “Search for easter — 13 resources”

    … though there are no ‘easter’ posts in ‘Category B’ and no results are shown.

    So the search and filter part is working fine (showing no results) but the ‘search count’ I have added seems to want to display all of them.

    I guess what I am really trying to say is what is the correct method to get a search count on my results page!

    : )

    Thanks!

    Trevor Moderator
    #80552

    This is something I tried to do a week ago on another site, but there does not seem to be a way to get the numbers. It is something we will most likely look at for the next major version.

    dann hanks
    #80564

    Hi Trevor, thanks for getting back to me.

    I think displaying the true number of results is a definate addition that needs to be made to the plugin, its a basic and fundamental part of search results. Please can you let me know when something is sorted for this? Or let me know how I can find out?

    I notice there is a working post counter on the demo here:

    http://demo.designsandcode.com/sfpro-woo-mystile/shop/

    how was that acheieved?

    Trevor Moderator
    #80566

    Part of it uses this, I think:

    <?php echo $query->found_posts; ?>
    
    dann hanks
    #80575

    that didnt work on mine at all.

    Trevor Moderator
    #80578

    If you are using your theme to make the loop, you would need to know what the theme names the query.

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.