rewrite taxonomy-{taxonomy}-{term}.php terms
rewrite taxonomy-{taxonomy}-{term}.php terms
rewrite taxonomy-{taxonomy}-{term}.php terms
It depends on what you’re developing the theme for. Premium Themes – Themes for the masses. If you’re going to sell or distribute the theme to many people use the template drop down which provides the most flexibility to the user. If they delete the page or rename the slug they can always reassign the … Read more
There is no need to create a custom taxonomy or custom template. When we click on any category then wordpress by default called archive.php file which has code for display posts related to that particular category. So first use this code in any of your php template file to display category lists: <?php $args = … Read more
You can include the same file in template-composers-terms.php and template-interprets-terms.php like that : <?php /* Template Name: List of composers */ $tax = “composer”; require “include/file_which_does_all_the_work.php”; and if the page slug is the same that the taxonomy slug, you can save the line $tax = … with that in the included file : $tax = … Read more
Always flush the rewrite rules when you register a new public post type or taxonomy. Otherwise the internal rewrite rules will not take that into account when an URL is mapped to a query. You can automate that process by hooking into registered_post_type and registered_taxonomy. Below is the updated code, based on feedback from comments … Read more
I had the same issue and your fix helped me a lot. After I fixed the issue with your solution I figured out that I had used a permalink in one custom post type that caused the issue. I used years / year and I think because wordpress uses something like this in its archive … Read more
WordPress Doesn’t Generate Taxonomy Archive
Try get_ancestors(): $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); $ancestors = get_ancestors( $term->term_id, ‘product_range’, ‘taxonomy’ ); $hierarchy_levels = count( $ancestors ); switch ( $hierarchy_levels ) { case 0: // THIS IS THE PARENT CATEGORY // DO YOUR STUFF break; case 1: // THIS IS THE PARENT CATEGORY // DO YOUR STUFF … Read more
How to Rewrite Taxonomy URL to Include the Post Type as the Second Segment of the URL?
The way I would organise this (and I have done this in the past) would be to have a post type for Work Sites, and a hierarchical taxonomy for Locations. Then what you would do is add States as the top-level of the Locations taxonomy, and then add Cities as children of the State locations. … Read more