Custom Post Type and Taxonomy URL rewrite

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

How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy

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

Taxonomy, Terms, and Template Files

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

Custom Taxonomy Archive Page

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

Custom Taxonomy and Tax_Query

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

Display category posts grouped by taxonomy

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