Search error on Roots Theme (now sage)

Forums › Forums › Search & Filter Pro › Search error on Roots Theme (now sage)

Viewing 10 posts – 1 through 10 (of 11 total)
  • Anonymous
    #16102

    Using a custom template for the search results:

    <?php echo do_shortcode('[searchandfilter id="22467"]'); ?>
    
    <?php
    
        $args = array(            
          'post_type' => 'post',
          'posts_per_page' => 10
        );
    
        $query = query_posts($args);
    
    ?>
    <div id="content">
    	<ul>
    <?php while (have_posts()) : the_post(); ?>
    
    <li>
    	<?php the_title();?>
    </li>
    
    <?php endwhile;?>
    	</ul>
    </div>

    I’ve set the filter to use a specific a page template page-category-results.php

    Anonymous
    #16191

    Anything on this?

    Ross Moderator
    #16231

    Hi Rory

    You must remove:

     <?php
    
        $args = array(            
          'post_type' => 'post',
          'posts_per_page' => 10
        );
    
        $query = query_posts($args);
    
    ?>

    If you have a query in your template, before you your loop – then it will overwrite the S&F query.

    Thanks

    Anonymous
    #16258

    Hey Ross,

    I’ve changed it to the following:

    <?php echo do_shortcode('[searchandfilter id="22467"]'); ?>
    
    <div id="content">
    	<ul>
    <?php while (have_posts()) : the_post(); ?>
    
    <li>
    	<?php the_title();?>
    </li>
    
    <?php endwhile;?>
    	</ul>
    </div>

    And it still has the same results (white page, returned results). It also doesn’t load the initial posts onto the page either like the demo does

    Ross Moderator
    #16262

    Ahhh a white page? What is the URL of this page? It looks liek you are seeing the Ajax request itself, which likely means there was a javascript error?

    Do you have a link I could look at? (I think this may be related to the 4.2 bugs I’m working on now).

    Thanks

    Anonymous
    #16264
    Ross Moderator
    #16275

    Ah ok, I see

    There seems to be nothing wrong with this then, you just don’t have the regular code for your headers and footers etc 🙂

    So what you would need to do is something like the following:

    <?php
    /**
     * Search Results Template
     *
     */
    
    get_header(); ?>
    
    <?php echo do_shortcode('[searchandfilter id="22467"]'); ?>
    
    <div id="content">
    	<ul>
    <?php while (have_posts()) : the_post(); ?>
    
    <li>
    	<?php the_title();?>
    </li>
    
    <?php endwhile;?>
    	</ul>
    </div>
    
    <?php get_footer(); ?>

    However, you may need to do more than this, depending on your theme – check a regular page template like page.php to see the structure of a typical page template in your theme.

    Thanks

    Anonymous
    #16279

    Hey Ross

    I got the filtering working now just fine which is awesome. Thank you.

    Issue now is there are no INITIAL RESULTS.

    Thoughts?

    http://emilyhenderson.wpengine.com/category-results

    Ross Moderator
    #16280

    This should be the search page you link to:

    http://emilyhenderson.wpengine.com/?sfid=22467

    If you want the URL to be different, update the “slug” option under “display results” – and then you can have your search page at something like:

    http://emilyhenderson.wpengine.com/my-slug

    Thanks

Viewing 10 posts – 1 through 10 (of 11 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.