Home › Forums › General Issues › Using Taxonomy to display custom posts › Reply To: Using Taxonomy to display custom posts
Terribly Sorry… don’t know why it didn’t work…
<?php
$member_group_terms = get_terms( ‘systemcontents_category2′);
$selected = get_sub_field(‘system_contents_posts’);
?>
<?php
foreach ( $member_group_terms as $member_group_term ) {
$member_group_query = new WP_Query( array(
‘post_type’ => ‘pj_systemcontents2′,
‘systemcontents_category2′ => $selected,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘systemcontents_category2′,
‘field’ => ‘slug’,
‘terms’ => array( $member_group_term->slug ),
‘operator’ => ‘IN’
)
)
)
);?>
<?php if ( $member_group_query->have_posts() ) : ?>
<h3><?php echo $member_group_term->name; ?></h3>
<?php while ( $member_group_query->have_posts() ) : $member_group_query->the_post(); ?>
<?php echo get_post_meta($post->ID,’document-section’,true) ?>
<?php echo get_post_meta($post->ID,’document-reference’,true) ?> <?php echo get_post_meta($post->ID,’document-sub-section’,true) ?>
<?php endwhile; ?>
<?php endif; ?>
<?php
// Reset things, for good measure
$member_group_query = null;
wp_reset_postdata();
}
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.