Loop with Custom Post Type and Taxonomies
Loop with Custom Post Type and Taxonomies
Loop with Custom Post Type and Taxonomies
show custom taxonomies in hierarchy
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
Switching from catalog to product category/subcategory
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
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
How to have working breadcrumbs with several taxonomies associated with a custom post type
change your $args array to the following $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 5, ‘tax_query’ => array( array( ‘taxonomy’ => ‘productcategories’, ‘terms’ => $term->name, ‘field’ => ‘name’ ), ), );
For the sorting, you are missing how you want to sort it. Use ‘order’ => ‘ASC’ or ‘order’ => ‘DESC’
Two issues here Never use extract(). It has been removed from core functions, that should tell you a lot. For more info, check this trac ticket #22400 Your tax_query is incorrect, it should be an array of an array, yours is just an array Your shortcode should look something like this function course_listings( $atts ) … Read more