Support Forums

The forums are closed and will be removed when we launch our new site.

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

Forums Forums Search & Filter Pro Additional loops on a results page possible?

Viewing 10 posts - 1 through 10 (of 11 total)
  • Richard L McCollam II
    #73381

    Site – https://www.potatogoodness.com/recipes

    For queries that provide no results I am wanting to list out popular recipes to encourage click through.

    On all archive pages, that are not a results page based on this plugin, I can run a new query and output posts as well as the original archive/taxonomy results, but on search pages I cannot.

    I assume this is due to the way that this plugin takes over the query. Is there a way for me to reset that somehow so I can run an additional loop? I have tried using wp_reset_postdata() at the end of my normal loop, but again I do’t think your plugin uses that on it’s results page.

    Any help here would be appreciated.

    Trevor Moderator
    #73623

    Are you using the Shortcode method for results? The sample results.php template we provide has the else condition that say no results found and this you can edit to do your own thing.

    Richard L McCollam II
    #74143

    I am using the post type archive setting for the results.

    Now knowing this is the results.php still relevant?

    Trevor Moderator
    #74508

    If you are using the Post Type archive method, then that uses theme templates, so you would need to modify the theme template to your needs.

    Richard L McCollam II
    #75265

    That is what I have done and what brought me to the point of reaching out. No matter what I have tried to do I cannot add an additional loop to the template. I have done this many other times on other sites I have built.

    Trevor Moderator
    #75296

    Have you always used the same theme/theme framework when you have done this before?

    Richard L McCollam II
    #75377

    Yes, it’s a straight forward archive page with the loop. I have been able to close the loop, reset the postdata, and run another custom loop.

    Trevor Moderator
    #75379

    OK. Well, when Ross gets in on Monday, I will ask him to take a look.

    Ross Moderator
    #75743

    Hi Richard,

    How are you defining your extra queries in the template?

    Basically, S&F doesn’t do anything too unusual when using the post type archive display method…

    All we do is modify the global query, using the WP filter pre_get_posts.. so the way you are using wp_post_reset should not change just because you are using S&F.

    As a test, can you disable S&F, and figure out if your additional queries now work?

    Let me know how you get on.

    Thanks

    Richard L McCollam II
    #77825

    I am running this query between the else and endif of the loop:

    `
    <?php

    $args = array(
    ‘post_type’ => ‘recipe’,
    ‘posts_per_page’ => 10
    );

    $the_query = new WP_Query($args);

    if (have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();

    get_template_part(‘partials/recipe-grid-item’);

    endwhile; endif;

    ?>
    `

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

The forum ‘Search & Filter Pro’ is closed to new topics and replies.