Forums Forums Search & Filter Pro Easy way to filter all posts?

Tagged: 

Viewing 7 posts - 11 through 17 (of 17 total)
  • Anonymous
    #179707

    Got it! Went as far as replacing the title PHP but it brings back the site title instead of the page title..

    <?php
    wp_title(‘<h1 class=”page-title”>’, ‘</h1>’);
    ?>

    Guess I’m using the wrong function.

    Also how do I show the number of results on the page? It was showing using the shortcode but not with the archive page.

    Is it also possible to show numbers next to the filters (eg. filtername (2) )?

    Trevor
    #179713

    You don’t need a function in there at all.

    You can simply put this:

    <header class="page-header">
      <h1 class="page-title">Search Results</h1>
    </header><!-- .page-header -->

    As for placing the search terms, that is a little harder. It would have to be done by your theme, or in that template. You can look at how we do it (for the Shortcode method) in the file results.php found in the plugin’s template folder, and also see this documentation:

    https://searchandfilter.com/documentation/accessing-search-data/

    Note that when the results update using Ajax, the search terms can only update if the method that you use to show these is inside the code that makes the id=”main” section of the page.

    Anonymous
    #179725

    OK – used a static title. Re the number of results I’ve copied the code from results.php but it doesn’t return the number:

    <?php if ( have_posts() ) : ?>
    <header class=”page-header”>
    <h1 class=”page-title”>My Title</h1>’
    </header><!– .page-header –>

    Found <?php echo $query->found_posts; ?> Results<br />
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?>

    And for the search term I meant “is possible to show the numbers next to the filters (on the search form)?” rather than on the results page.

    Anonymous
    #179727

    Just noticed one more issue an empty article is showing if there are no results – Pls try to filter by “lunch” + “raw”.

    Trevor
    #179729

    I changed the code in the template file a bit for you ($query to $wp_query).

    In each field I set the display count option, and also hide empty

    Also, I set auto Count to ON.

    Is that better?

    Trevor
    #179731

    But it doesn’t seem to show the actual page number. Not sure why.

    Anonymous
    #179733

    Brill – that’s ok I can work without the page number and the filters work better 👌

    Thanks for your help!

Viewing 7 posts - 11 through 17 (of 17 total)