Create permalink structure for one taxonomy archive per custom post type

This is very easy to do by adding custom rewrite rules. This should get you started: add_action( ‘init’, ‘wpse_100386_rewrites’ ); function wpse_100386_rewrites() { add_rewrite_rule( ‘case-studies/room/([^/]+)/?’, ‘index.php?the_room=$matches[1]&post_type=the_case_study’, ‘top’ ); add_rewrite_rule( ‘videos/room/([^/]+)/?’, ‘index.php?the_room=$matches[1]&post_type=the_video’, ‘top’ ); } As always when changing rewrite rules, be sure to flush your rewrite rules by going to Settings -> Permalinks and click … Read more

Using URL parameters, list posts from category and custom taxonomy

In general circumstances, using URL parameters, you can list posts that belong to a specific category AND a custom taxonomy, like this: http://example.com/category/cars/?edition=usa Where, category is the Category base you are using for categories on your site (WordPress Dashboard > Settings > Permalinks > Category base); edition is the custom taxonomy’s base/slug; and usa is … Read more

has_term or in_category for Custom Post Types

has_term() need third parameter to specify which post type have this term. So, your code would be if ( has_term(‘sold’, ‘category’, ‘property’)) { ?> <div class=”sold_prop_note”> <h3>This Property is sold. Take a look at our current exclusives! <a href=”https://wordpress.stackexchange.com/properties”>View Exclusives</a></h3> </div> <?php } Beside that approach, you can use following global $post; if ( ( … Read more

Get total number of comments from posts in a specific custom taxonomy

You’ll need to loop through your posts, use get_comments_number() to get the number of comments for each post, and then accumulate the total number of comments in a separate variable. e.g.: <?php $features_comment_count = 0; if ( have_posts() ) : while ( have_posts() ) : the_post(); $features_comment_count += get_comments_number(); endwhile; endif; ?> (I’ll assume that … Read more

Taxonomy slug by term ID

For a menu object $item: $item->object stores the object the menu item refers to, e.g. ‘post’, ‘page’, ‘my-cpt’, or ‘my-taxonomy’ (the post type name, or the taxonomy name) $item->type stores what ‘type’ of object is it, either: ‘post_type’ or ‘taxonomy’. For custom links, these are both custom

A better Media LIbrary Experience

Yes, the media library is long overdue an overhaul, and it seems there are some guys working on it right now. With any luck some changes will make it in to the next release. Take a look here at some of the slides and the many commments and feedback: http://make.wordpress.org/ui/2012/07/30/media-wireframes/