Custom Taxonomy Hierarchy for Custom Post Types (eg Categories and Subcategories)

Hierarchical refers to the terms relation to each other not the taxonomies relation to another taxonomy. Non hierarchical taxonomies are like tags they don’t have parents or children. Hierarchical taxonomies means that the terms can have parents and children. taxonomy = category category terms: blue products (parent term) light blue products (child term) dark blue … Read more

How can I show recent posts from same taxonomy as the post currently being viewed?

Have you tried using get_the_terms()? Quick-and-dirty, from your code example: <?php global $post; $terms = get_the_terms( $post->ID, ‘some-term’ ); foreach ($terms as $category) : ?> <h3>More News From This Category</h3> <ul> <?php $posts = get_posts(‘numberposts=20&category=’. $category->term_id); foreach($posts as $post) : ?> <li><a href=”https://wordpress.stackexchange.com/questions/39455/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endforeach; ?> <li><strong><a href=”<?php echo get_category_link($category->term_id);?>” title=”View … Read more

Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks

If you’re running WordPress 3.0.1 or later, I believe your problem lies with the ‘post_type_link’ filter declaration and function arguments. When the ‘post_type_link’ filter is applied, it passes the following 4 arguments: apply_filters(‘post_type_link’, $post_link, $post, $leavename, $sample); But your function accepts $post_link and $id. Try the following adjustments: function custom_post_link( $post_link, $post ) { if … Read more

How to get a list of taxonomy terms which are being used only within certain post types?

I’m not a programmer so there’s probably a far more efficient/correct way of doing this. Put this in functions.php or a custom plugin: function get_terms_by_post_type( $taxonomies, $post_types ) { global $wpdb; $query = $wpdb->get_results( “SELECT t.*, COUNT(*) from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $wpdb->term_relationships AS r … Read more