Forums › Forums › Search & Filter Pro › Custom query setup
Tagged: V3
- This topic has 8 replies, 2 voices, and was last updated 4 years, 11 months ago by Trevor.
-
Anonymous(Private) December 19, 2019 at 3:02 am #229445
Hi, Trevor. I’d contacted you previously about using the plugin with BB Themer (but my use-case was a bit far outside your scope). I’ve stepped outside Themer and have handcoded (to the best of my abilities) a basic query that initially displays the posts in the correct cluster (layout will come later). I set up a filter targeted to the CPT and added the filter with a do_shortcode.
The filter appears, correctly showing the the drop-down the 2 posts that have the taxonomy to be filtered by (Location) but upon selecting that taxonomy, the pages refreshes (I want to stay on the same page) but there’s no filtering.
Following is my code. Am I missing something or just a bad query setup? Or a bad filter setup?
Thanks for taking a look,
Tim=========
<div class="fl-content-full container"> <div class="row team-badges" style="padding-top:150px;"> <?php echo do_shortcode('[searchandfilter id="1623"]'); ?> <div class="fl-content col-md-12 teamtest"> <?php $cats = get_terms( array( 'taxonomy' => 'teams', 'orderby' => 'menu_order', 'order' => 'ASC' ) ); foreach ($cats as $cat) : ?> <h2><?php echo $cat->name; ?></h2> <?php $peeps = new WP_Query( array( 'post_type' => 'people', 'orderby' => 'menu_order', 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => 'teams', 'field' => 'slug', 'terms' => array($cat->slug), ) ) )); if ($peeps->have_posts()) : while ($peeps->have_posts()) : $peeps->the_post();?> <li> <?php the_title(); ?> </li> <?php endwhile; wp_reset_postdata(); endif; endforeach; ?> </div> </div> </div>
-
AuthorPosts