Any way to make posts inherit properties/taxonomies through a single assigned taxonomy
I’d suggest to use Posts 2 Posts plugin, see plugins page and wiki for more information
I’d suggest to use Posts 2 Posts plugin, see plugins page and wiki for more information
I have used my jewelery post type bellows code, You can just replace your post type & taxonomy. Just copy & paste on your functions file. <?php //Register a Jewelry post type. function jewelry_post_register() { $labels = array( ‘name’ => _x( ‘Jewelries’, ‘post type general name’, ‘twentytwelve’ ), ‘singular_name’ => _x( ‘Jewelry’, ‘post type singular … Read more
After adding print_r($wp_query); to my template and examining the results, I have discovered URL formats that work. I wrote, in my question, that the following format doesn’t work — in fact, it does – if you spell your custom taxonomy name correctly. example.com/?ctxname=term1+term2 Pretty URLs with the ‘+’ and ‘,’ operators (indicating AND and OR … Read more
These types of URLs are supported since WP 3.1: register_taxonomy( ‘types’, ‘post’, array( ‘hierarchical’ => true, ‘rewrite’ => array( ‘hierarchical’ => true ), … ); Remember to flush the rewrite rules after making the change. The template you would use for both parent and child terms is taxonomy-types.php: $current_term = get_queried_object(); if ( 0 == … Read more
That is how taxonomies works by default in WordPress. There is not an archive page for “All posts that belongs to any term of a taxonomy”. And, conceptually, it is correct. Imagine you want to list all items of a biological taxonomy system: that is listing all organisms. If you translate to posts, it is … Read more
First of all, you run register_post_type on init and register_taxonomy on after_setup_theme which is called after init. This means your custom taxonomy will not be available when registering the post type. I would suggest you remove the taxonomies keyword from the register_post_type arguments array, and just register the taxonomy manually afterwards. In your example code … Read more
The problem can only be one of the following: Your taxonomy “recipecategory” does not exist. Your taxonomy has no terms. None of your recipecategory terms have any posts. In this case, make the following change: $tax_terms = get_terms($taxonomy, array(‘hide_empty’ => false)); This should work as it will override the default setting, which is to ignore … Read more
Since WordPress 4.7 the filter argument for any post endpoint was removed. But if you need them, add them via plugin. The WP API Repo have a plugin ‘Rest Filter’ for this job, small and short.
This by default is not possible, and using the CPT and Custom Tax registration APIs, is not possible. And for good reason. It’s all to do with permalink and slug clashes, and removing ambiguity. Admittedly there are cases where unique URLs that never overlap are not allowed by the system for this reason ( false … Read more
I’ve found a solution! <?php // Get current Category $get_current_cat = get_term_by(‘name’, single_cat_title(”,false), ‘category’); $current_cat = $get_current_cat->term_id; // List posts by the terms for a custom taxonomy of any post type $post_type=”myposttype”; $tax = ‘mytaxonomy’; $tax_terms = get_terms( $tax, ‘orderby=name&order=ASC’); if ($tax_terms) { foreach ($tax_terms as $tax_term) { $args = array( ‘post_type’ => $post_type, “$tax” … Read more