Forums Forums Search & Filter Pro How to not show results in first search + translate "Older/ newer posts"

Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #73579

    [split by @trevorsf from https://support.searchandfilter.com/forums/topic/how-to-not-show-results-in-first-search-translate-older-newer-posts-2/ ]

    Hello!

    I have the same problem and can’t find the place to put your suggested solution (quoted below). Could you help me out? 🙂


    Something like this:

    <?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link http://www.designsandcode.com/
    * @copyright 2015 Designs & Code
    *
    * 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
    *
    */

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1726)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()==””)) {
    echo ‘<div>Nothing to see here folks!</div>’;
    } else {

    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 think?

    Trevor
    #73613

    Hi

    I have split the thread so that you are the author (means we can do private messages if needs be).

    Could you better describe what you want and what you have tried so far. I assume that you are using the shortcode method and you have a custom version of the results.php file in a search-filter sub-folder of your child theme folder?

    BTW, it makes code easier to handle if you insert it between two code tags (see the button on the editor toolbar, one before and one after).

    Anonymous
    #74046
    This reply has been marked as private.
    Trevor
    #74054
    This reply has been marked as private.
    Trevor
    #74282
    This reply has been marked as private.
    Anonymous
    #74300
    This reply has been marked as private.
    Trevor
    #74320

    Great to speak with you. That’s all resolved now so I will close this thread, OK?

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