Get Taxonomy slug from ACF taxonomy field

<?php $term = get_sub_field('field_name'); if( $term ): ?> <?php $postType = $term->slug;?> /* Query Loop using variable $postType to use specific category */ <?php query_posts( array('post_type' => 'pulp_collection','showposts'=>-1, 'orderby'=> 'title', 'order' => 'ASC','pulps_collection_category' => $postType)); if ( have_posts() ) : while ( have_posts() ) : the_post();?> <?php if(get_field('library_builder')): ?> <?php while(has_sub_field('library_builder')): ?> <h2 class="acc-head"><?php the_title();?><i class="material-icons">add_circle_outline</i></h2> <div class="acc-body"> <div class="pulp_mag_copy"><?php the_sub_field('mag_summary');?></div> <div class="covers"> <?php include('new-issue-repeater.php');?> </div> </div> <?php endwhile; ?> <?php endif; ?> <?php endwhile; endif; wp_reset_query(); ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.