Loop for displaying posts within a taxonomy
-
I have some code for displaying a taxonomy “wood_type” but nothing is showing up with the code that I have here. Any ideas?
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content' ); //for a given post type, return all $post_type = 'molding_profile'; $tax = 'wood_type'; $taxonomy_term_id = $wp_query->queried_object_id; $tax_terms = get_terms($tax, 'slug='.$queried_term); if ($tax_terms) { foreach ($tax_terms as $tax_term) { $args=array( 'post_type' => $post_type, "$tax" => $tax_term->slug, 'post_status' => 'publish', 'posts_per_page' => -1, ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <div style="padding-left:0;" class="four columns left for-mobile"> <div style="text-align:center;" class="twelve columns mp-img"> <a href="<?php the_permalink(); ?>"> <img src="<?php the_field('profile_thumb_image'); ?>" /> </a> </div> <div style="text-align:center; margin-bottom:30px;"> <span style="margin-right:12px; color:#3F7091;"><?php the_title(); ?></span> <span style="color:#A97147"><?php the_field('profile_dimensions'); ?></span> </div> </div> <?php endwhile; } wp_reset_query(); } } ?> <?php endwhile; endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Loop for displaying posts within a taxonomy’ is closed to new replies.