Created
October 10, 2011 12:32
-
-
Save mattboon/1275191 to your computer and use it in GitHub Desktop.
WordPress - Query Custom Post Type and taxonomy term by ID
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
<?php | |
// gets the ID from a custom field to show posts on a specific page | |
$buildType = get_post_meta($post->ID, 'build_type_id', true); | |
// run query | |
query_posts(array( | |
'post_type' => 'portfolio', | |
'showposts' => -1, | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'build-type', | |
'terms' => $buildType, | |
'field' => 'term_id', | |
) | |
), | |
'orderby' => 'title', | |
'order' => 'ASC' ) | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment