Forums › Forums › Search & Filter Pro › Custom integration with categories
- This topic has 4 replies, 2 voices, and was last updated 7 years, 3 months ago by Anonymous.
Viewing 5 posts - 1 through 5 (of 5 total)
-
Anonymous(Private) July 13, 2017 at 12:32 am #120314
I was attempting to add in the Search Filter ID to my existing WPQuery which went through some categories. Would there be a better approach tp getting this to work?
$custom_terms = get_terms('wpsl_store_category'); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array( 'post_type' => 'wpsl_stores', 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => 'wpsl_store_category', 'field' => 'slug', 'terms' => $custom_term->slug, ), ), ); $args['search_filter_id'] = 1478; $loop = new WP_Query($args); if($loop->have_posts()) { echo '<h2>'.$custom_term->name.'</h2>'; while($loop->have_posts()) : $loop->the_post(); echo get_the_title(); endwhile; } }
Anonymous(Private) July 17, 2017 at 7:16 pm #121056I set the Display Results to Custom. I put the code within a page template file and output the shortcake via PHP as well:
echo do_shortcode('[searchandfilter id="1478"]');
I’m just not getting any results showing:
http://nmfma.identifiedmedia.com/?page_id=1481
If I remove the
$args['search_filter_id'] = 1478;
then all results display. -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)