• Hello guys, i need to query posts from a specific custom post type and from a specific taxonomy category.

    I’ve got the following loop

    <?php $folio_loop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => get_post_meta($post->ID, 'ep_portfolio_posts_per_page', true), 'orderby' => 'menu_order' ) ); ?>
    
    	 	<?php while ( $folio_loop->have_posts() ) : $folio_loop->the_post(); ?>
    
    	 	<?php endwhile; ?>

    now, i’ve created a taxonomy named portfolio_categories , and i’ve created a category (using the taxonomy) with the name “One Column” what should i have to do in order to get posts only from that taxonomy category ?

    Thanks…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try adding the taxonomy and term to your query, like this:

    <?php $folio_loop = new WP_Query( array( 'portfolio_categories' => 'one-column', 'post_type' => 'portfolio', 'posts_per_page' => get_post_meta($post->ID, 'ep_portfolio_posts_per_page', true), 'orderby' => 'menu_order' ) ); ?>
    
    	 	<?php while ( $folio_loop->have_posts() ) : $folio_loop->the_post(); ?>
    
    		<?php endwhile; ?>

    super! worked beautifully for me!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Post Type taxonomy loop’ is closed to new replies.