Support Forums

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

Forums Forums Search & Filter Pro show results only after clicking search

Viewing 6 posts - 1 through 6 (of 6 total)
  • Andres Raffo
    #208443

    Good afternoon, I have set the custom filter on this page https://www.starpets.com.co/antioquia/ but I would like to enter the page by default not show the results, that is, input only show the filter options and click on search, if the results are displayed, is this possible?

    Andres Raffo
    #208449

    Here I have to add something, I have several pages and in each one I use a different personalized filter, each page corresponds to a department of Colombia, therefore, what we are looking for, is that the search result only brings results from that department, that’s why, if you go to the next two pages, you can see that the filter results are different.

    https://www.starpets.com.co/antioquia/
    https://www.starpets.com.co/cundinamarca/

    This I clarify, since after reviewing the help forum, I found this answer that you gave previously to a user https://support.searchandfilter.com/forums/topic/prevent-empty-search-fetching-results/#post -185868 but I do not know if it applies to my project, since here you indicate that you should replace the id of the page, but if there are several forms and each one has a different id, how can I achieve what you indicate?

    and so the code of my results.php file is displayed:

    <?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link https://searchandfilter.com
    * @copyright 2018 Search & Filter
    *
    * Note: these templates are not full page templates, rather
    * just an encaspulation of the your results loop which should
    * be inserted in to other pages by using a shortcode – think
    * of it as a template part
    *
    * This template is an absolute base example showing you what
    * you can do, for more customisation see the WordPress docs
    * and using template tags –
    *
    * http://codex.wordpress.org/Template_Tags
    *
    */
    
    if ( $query->have_posts() )
    {
    ?>
    
    Found <?php echo $query->found_posts; ?> Results<br />
    Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    
    <div class="pagination">
    
    <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists('wp_pagenavi'))
    {
    echo "<br />";
    wp_pagenavi( array( 'query' => $query ) );
    }
    ?>
    </div>
    
    <?php
    while ($query->have_posts())
    {
    $query->the_post();
    
    ?>
    <div>
    <h2>"><?php the_title(); ?></h2>
    
    <p><br /><?php the_excerpt(); ?></p>
    <?php
    if ( has_post_thumbnail() ) {
    echo '<p>';
    the_post_thumbnail("small");
    echo '</p>';
    }
    ?>
    <p><?php the_category(); ?></p>
    <p><?php the_tags(); ?></p>
    <p><small><?php the_date(); ?></small></p>
    
    </div>
    
    <hr />
    <?php
    }
    ?>
    Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    
    <div class="pagination">
    
    <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists('wp_pagenavi'))
    {
    echo "<br />";
    wp_pagenavi( array( 'query' => $query ) );
    }
    ?>
    </div>
    <?php
    }
    else
    {
    echo "No Results Found";
    }
    ?>

    I do not know if there is something wrong here too, because in the page where I’m trying to find the code, at the end of the results, this comes out:

    global $searchandfilter; $sf_current_query = $searchandfilter->get(2101)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()==””)) { echo ‘
    Nothing to see here folks!
    ‘; } else { // your template archive code/loop OR results.php code here }

    Trevor Moderator
    #208486
    This reply has been marked as private.
    Andres Raffo
    #208543
    This reply has been marked as private.
    Andres Raffo
    #208547
    This reply has been marked as private.
    Trevor Moderator
    #208608
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.