How to Display Posts From Category Within a Custom Taxonomy?

@Krzysiek answer above didn’t work because have_posts is a method not a property. It should be have_posts() not have_posts. Here’s the corrected code: $my_query = new WP_Query( array( ‘post_type’=>’news’, ‘posts_per_page’=>4, ‘tax_query’=>array( array( ‘taxonomy’=>’instituteName’, ‘field’=>’slug’, ‘terms’=>’businessschool’ // change to real slug ) ) ) ); while ( $my_query->have_posts() ) { $my_query->the_post(); // display post }

Echo custom taxonomy slug

Here’s the correct syntax for what you’re trying to do, if there’s just the single value for the ‘series’ custom taxonomy slug that you’re trying to retrieve. You were passing the whole array to your echoed string. I made a new variable $series which pulls the first/only value in the $terms_slugs array. And simplified a … Read more

Get all attachments by custom taxonomy – term

To get all images from the same term you can use WP_Query with the “tax_query” argument: $args = array( ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ‘post_type’ => ‘attachment’, ); $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘YOUR_CUSTOM_TAXONOMY’, ‘terms’ => array( ‘YOUR_CUSTOM_TAXONOMY_TERM’ ), ‘field’ => ‘slug’, ), ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() … Read more

How to list tags from custom post type attachments?

get_the_tags() function in deed returns only terms of ‘post_tag’ taxonomy (tags). If you’d like to get terms of another taxonomies, you’d have to use get_the_terms function (http://codex.wordpress.org/Function_Reference/get_the_terms) $custom_post_tags = get_the_terms( get_the_ID(), ‘type’ ); //type is a name of custom taxonomy or you can use wp_get_object_terms function (http://codex.wordpress.org/Function_Reference/wp_get_object_terms) where you can define more than one taxonomy … Read more

get_category_link() for custom post type does not include custom slug rewrite?

Your category URLs are correct, they won’t change by virtue of being associated with a custom post type. I’ll guess that the problem is that default category queries do not include any custom post types, so will display “Nothing found” on term pages where the only associated posts are a CPT. To fix that, you … Read more

Exclude taxonomy term from all loops, but having it on widget

Looks like you’ve excluded a taxonomy term, not the whole taxonomy. Is that what you intended? But on to the answer… Right before your query in the widget add: remove_action( ‘pre_get_posts’, ‘exclude_category_posts’ ); And then you probably want to put it back again after that query by repeating: add_action( ‘pre_get_posts’, ‘exclude_category_posts’ ); That is a … Read more