Forums Forums Search & Filter Pro Shortcode results: don't display results until click

Tagged: 

Viewing 10 posts - 1 through 10 (of 20 total)
  • Anonymous
    #51719
    This reply has been marked as private.
    Anonymous
    #51722
    This reply has been marked as private.
    Trevor
    #51732

    Hi

    Sadly the code you posted has gotten mangled by the forum script 🙁

    Before the block of code and after it needs to be a code tag. On my screen, above where I am typing this, I can see the formatting buttons (bold, italic etc) and the last but one is the code tag button. Press this once before and once after the code. You will see it actually types a ‘back tick’, if you can see the button bar that is. Otherwise, on my keyboard, the symbols button to the left of the 1 key also types the same back tick.

    Can you re-post the results.php code?

    Anonymous
    #51736
    This reply has been marked as private.
    Trevor
    #51738

    Hi

    I found two errors (one was ours, one yours), so here is the fixed code (I do not know if this will work):

    <?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
     *
     */
    
    if ( $query->have_posts() ) {
        global $searchandfilter;
        $sf_current_query = $searchandfilter->get(44)->current_query();
        if ($sf_current_query->is_filtered()) {
            ?>
    
            <?php echo $query->found_posts; ?> Firm(s) Meet All Selected Criteria<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>
                    <h6><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6>
    
                    <p><?php the_tags(); ?></p>
    
                </div>
    
                <hr/>
                <?php
            }
            ?>
    
            <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 firms meet all of your criteria. Try unchecking some boxes.";
        }
    }
    ?>
    Anonymous
    #51739
    This reply has been marked as private.
    Trevor
    #51787

    Try changing this:

    if ( $query->have_posts() ) {
    

    to this:

    if ( !$query->have_posts() ) {
    

    Maybe?

    Anonymous
    #51929
    This reply has been marked as private.
    Trevor
    #51934

    And the shortcode id for the search IS 44?

Viewing 10 posts - 1 through 10 (of 20 total)