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

Viewing 10 posts - 1 through 10 (of 10 total)
  • Trevor
    #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.

    Anonymous
    #74143

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

    Now knowing this is the results.php still relevant?

    Trevor
    #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.

    Anonymous
    #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
    #75296

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

    Anonymous
    #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
    #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

    Anonymous
    #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;

    ?>
    `

    Ross Moderator
    #77831

    I’m not sure if running a query inside a loop is such a great idea but it should work… I would do it outside the loop, and reference the variable where needed.

    Anyway, did you try what I asked, to get this working with S&F disabled? If you can get it working without S&F then I can advise as to any problems S&F may be causing…

    I have a feeling this is more a logic issue on your side rather than a S&F issue (as S&F really doesn’t do anything odd that should prevent normal WP_Query usage), but as mentioned, if you can get it working without S&F enabled it would of course point to a S&F bug.

    Thanks

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