Forums › Forums › Search & Filter Pro › Custom Post Types with Search & Filter Pro
- This topic has 4 replies, 2 voices, and was last updated 10 years, 4 months ago by
Anonymous.
-
Anonymous(Private) January 14, 2015 at 11:35 pm #10281
Hi Ross,
I have two separate pages that are each running a separate Filtering system. On one (Blog), I am looping through all of my Posts and the filtering system is working well. On the other (Thoughts), I am looping through a Custom Post Type:
<?php $args = array( 'post_type' => 'thoughts'); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php get_template_part( 'thought', 'search' ); ?> <?php endwhile; ?>
and the filtering system does not return anything.
Oddly, if I change the Thoughts page template so that it loops through all Posts, regardless of post type
<?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'search' ); ?> <?php endwhile; ?>
then the filtering system works properly.
Does Search & Filter Pro only work with a normal WordPress loop, or is there something behind the scenes that I can add/change to solve this issue?
Best,
AlexRoss Moderator(Private) January 15, 2015 at 12:04 am #10283Hey Alex
S&F uses the loop – it doesn’t mean you can’t use other queries but you must allow for the loop to proceed normally…
Usually you must reset the query – see the codex for nested queries and how to reset –
http://codex.wordpress.org/Function_Reference/wp_reset_postdata
🙂
Ross Moderator(Private) January 15, 2015 at 12:05 am #10284PS the alternative is to use a shortcode for results – which you can place anywhere – but you must be confident with html/css to style the results yourself 🙂
-
AuthorPosts