Under each Term, i need to show every posts with post_type = 'courses'e taxnonomy = 'courses_category'
What will be the query to display those records?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
You will need to use this code:
$the_query = new WP_Query( array( 'post_type' => 'courses', 'tax_query' => array( array ( 'taxonomy' => 'courses_category', 'field' => 'slug', 'terms' => 'yourterm' ) ), ) ); while ( $the_query->have_posts() ) : $the_query->the_post(); // Show Posts ... endwhile;
You can convert this in shortcode and just append it on your page trough your wordpress content editor or just insert this where you want to show your posts.
Check Codex or this link
$query = new WP_Query(array( 'post_type'=>'courses', 'nopaging'=>true, 'tax_query'=> array( array('taxonomy'=>'courses_category', 'field'=>'slug', 'terms'=>'recursos-humanos'//replace this with the term slugs ) ) ));
I would probably use three queries for the three terms you have above (changing the 'terms' value with the slug of the taxonomy term. You could get fancy and link all three terms together with a single query ordered by post type.