Created
January 6, 2017 14:32
-
-
Save solid-pixel/93ffe0f0418f292412f83c19565990bd to your computer and use it in GitHub Desktop.
Grab Custom Posts from specific Taxonomy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<?php | |
$query = new WP_Query( array( | |
'post_type' => 'course', //post type slug | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'course_type', //taxonomy slug | |
'field' => 'slug', | |
'terms' => 'post-graduate') //term slug | |
)) ); | |
if ( $query->have_posts() ) : ?> | |
<?php while ( $query->have_posts() ) : $query->the_post(); ?> | |
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
<?php endwhile; wp_reset_postdata(); ?> | |
<?php endif; ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment