Organizing The Custom Post Type with Taxonomies / Parent Posts

I think it could be a good idea to create two more hierarchical (category like) taxonomies, called Artists and Albums. This way, you’ll be able to query your posts based on taxonomy / term relationships. Basically, what I’m saying is this: Artists -> custom hierarchical taxonomy List item -> custom hierarchical taxonomy Songs -> custom … Read more

Hiding all posts/products/pages from a site based on a custom taxonomy/domain name

From the Codex for pre_get_posts: pre_get_posts cannot be used to alter the query for Page requests (page templates) because ‘is_page’, ‘is_singular’, ‘pagename’ and other properties (depending if pretty permalinks are used) are already set by the parse_query() method. See: Query Overview. The recommended way to alter the main query for page requests is to use … Read more

Get list of CPT posts in *current* post’s taxonomy term

You can get the Packages of the current Proposal using wp_get_object_terms() and then pass some/all of those into a WP_Query. $terms = wp_get_object_terms( $post_id, ‘packages’, array( ‘fields’ => ‘ids’ ) ); $args = array( ‘post_type’ => ‘proposals’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘packages’, ‘terms’ => $terms ) ), ); $related = new WP_Query( $args … Read more