Filter custom post type loop if check box is true
-
Hi Im trying to create a featured posts section, using the “Custom Filed Suite” plug in
I want to show a post/posts from 2 custom post types, but only if the check box is checked.
the loop i have so far is
<?php // query the posts of your custom post types query_posts( array( 'post_type' => array( 'post', 'bha_news', 'bha_members_news' ), 'showposts' => '10' ) // or 10 etc. however many you want ); ?> <?php // have some posts? if (have_posts()) : while (have_posts()) : the_post(); // begin the Loop ?> <?php the_title(); ?> <?php endwhile; endif; wp_reset_query(); ?>
The code to retrieve the “custom field suite” meta value is
<?php echo $cfs->get('field_name'); ?>
but i have no idea where or how to filter using custom field suite….I only want to show posts where the custom post type matches and where the checkbox is checked.
I hope this makes sense?
Many THanks for any help?
- The topic ‘Filter custom post type loop if check box is true’ is closed to new replies.