Forums › Forums › Search & Filter Pro › Additional loops on a results page possible?
- This topic has 10 replies, 3 voices, and was last updated 8 years, 6 months ago by
Ross.
-
Ross Moderator(Private) December 12, 2016 at 4:16 pm #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(Private) December 20, 2016 at 4:10 pm #77825I 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(Private) December 20, 2016 at 4:27 pm #77831I’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
-
AuthorPosts