How to show all possible parents and children of a hierarchical taxonomy term?
How to show all possible parents and children of a hierarchical taxonomy term?
How to show all possible parents and children of a hierarchical taxonomy term?
Removing custom post type slug from URL
OK, so you’ve used / as you taxonomy slug. It means that URL for your term is: http://example.com/my-sample-taxonomy-term/ And for pages it will be: http://example.com/my-sample-page/ As you can see, there is no way to guess, what type of post should WP search for. WordPress processes the URLs looping through registered Rewrite Rules and matching given … Read more
This only takes care of two levels. You could make a recursive function, if you have ‘unlimited’ levels. $custom_terms = get_terms(‘custom_taxonomy’); /** * Loop through all taxonomies */ foreach($custom_terms as $custom_term): // Reset query (for good measures sake) wp_reset_query(); // Set the args (getting ready to get posts that are in the given taxonomy) $outer_args … Read more
WordPress custom taxonomy, posts urls
After researching some more I’ve given up trying to use the taxonomy template and opted for a plugin to amend the permalinks. I followed some of the advice from this similar question: Taxonomy archive with same slug as custom post type? Currently I am using an amended archive template for the custom post types and … Read more
You haven’t properly registered the taxonomy for your post type. You register your post type like this: register_post_type( ‘custom-post-type-1′, Meaning that your post type is named custom-post-type-1. But when you register the taxonomy, you’re registering it for a post type called my-menu“ register_taxonomy( ‘custom-taxonomy’, ‘my-menu’, You need to register your taxonomy for your post type: … Read more
In your code you’re using this to register taxonomy: register_taxonomy( ‘events_category’, array( ‘events’ ), $args ); So the taxonomy is called events_category. And in get_terms you use events_categories. Here’s the fixed getting terms part: $terms = get_terms( array( ‘taxonomy’ => ‘events_category’, ‘hide_empty’ => false ) );
Most of your code looks OK. But there is a major problem with your WP_Query in portfolio template. Your query looks like this: <?php $query = new WP_Query( array( ‘slug’ => ‘design’ ) );?> And if you take a look at WP_Query docs, you’ll see there is no parameter called slug. So it’s pretty clear … Read more
Custom taxonomy query is empty. 0 = 1 in SQL