Custom rewrite url structure for several custom taxonomy (NOT pos_type)

The rewrite rules to resolve these requests are fairly simple: function wpd_property_rules(){ add_rewrite_rule( ‘property-city/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$’, ‘index.php?property_city=$matches[1]&property_type=$matches[2]&paged=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘property-city/([^/]+)/([^/]+)/?$’, ‘index.php?property_city=$matches[1]&property_type=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘wpd_property_rules’ ); There are a couple of problems though. You’ll need to generate these links somehow, but there’s no relationship between two taxonomies except by looking at all posts to … Read more

Specific template for subcategory of custom taxomy

You could use the template_include hook to load a specific template for your taxonomy. You would need to change out any instances of my-taxonomy with your specific custom taxonomy and switch out the brand-subcategories.php with whatever your template name is. /** * Force Taxonomy Subcategories to new template * * @param String $template – Expected … Read more

How can I get the last 5 element of this tax query?

add the ‘date_query’ parameter to your query and include the current year. $args = array( ‘post_type’ => ‘news’, ‘posts_per_page’ => 5, ‘post_status’ => ‘publish’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘week’, ‘field’ => ‘slug’, ‘terms’ => date(“W”, strtotime(“this week”)), ) ), ‘date_query’ => array( array( ‘year’ => date(“Y”) ) ) );