Use different categories for a custom post

Do you mean having different taxonomies for your custom post types? If so, you can define custom taxonomies and apply this taxonomies only to the post types you want. If the custom taxonomy has “hierarchical” argument set to true, the taxonomy will be works the same way categories do. register_taxonomy( ‘my_taxonomy_name’, ‘my_custom_post_type’, array( ‘hierarchical’ => … Read more

Displaying Posts Attached to Custom Taxonomy Terms

The way you query for Taxonomy is deprecated, see the reference in the Codex: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters So instead of ‘taxonomy’=> $taxonomy, you should use this: ‘tax_query’ => array( array( ‘taxonomy’ => $taxonomy, ‘field’ => ‘slug’, ‘terms’ => $section->slug ) ) And make sure that $taxonomy is defined!

Custom Post type Query by Taxonomy

I think showposts was replaced by posts_per_page in wordpress 2.1. See pagination parameters. Also note that print_r($query) won’t return any results because $query variables is WP_Query object; you need to exceute the query. $args = array( ‘post_type’ => ‘contractors’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => $taxonomy, ‘terms’ => $taxarray, ‘field’ => ‘id’ … Read more

Custom Taxonomy dont save in a frontend form for post a custom post

I think you have used wrong tax_input parameter value for wp_insert_post() function it should be array like this array( ‘taxonomy_name’ => array( ‘term’, ‘term2’, ‘term3’ ) ) as shown in the following code $my_post = array( ‘post_title’ => $title, ‘post_content’ => $content, ‘post_status’ => ‘publish’, ‘post_type’ => ‘faenas’, ‘tax_input’ => array( ‘faenas_combenef_category’ => array( $location … Read more

WordPress custom taxonomy

get_terms(); accept include as an array, you are trying with a string term id instead of array, try this $parent_terms = get_terms($taxonomyName, array(‘include’ => array(’67’), ‘orderby’ => ‘slug’, ‘hide_empty’ => false));

Add custom post type taxonomy tag to article class

Ah, solved it! <aside class=”work_item <?php $posttags = get_the_terms($post->ID, ‘type’); if ($posttags) { foreach($posttags as $tag) { echo str_replace(‘-‘,’_’,$tag->slug . ‘ ‘); } } ?>” data-type=”<?php $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { echo str_replace(‘-‘,’_’,$tag->slug . ‘ ‘); } } ?>”> had to use the get_the_terms() function

Custom Taxonomy Filter Issues

I believe that the problem is with this line: $var = &$query->query_vars[$tax_slug]; &$query is not necessary, simle $query should be enaught. $query->query->vars[$tax_slug] returns not an ID of term, but term’s slug So $term = get_term_by( ‘id’, $var, $tax_slug ); should be changed to $term = get_term_by( ‘slug’, $var, $tax_slug ); But is not necessary as … Read more

Permalink issues with custom taxonomies

I think that when you define custom rewrite slugs in the registration of a custom taxonomy, you still need to add custom rewrite rules. add_action(‘init’,’my_add_rewrite_rules’); function my_add_rewrite_rules() { add_rewrite_rule( ‘rights/category/(.+)/page/([0-9]{1,})/?$’, ‘index.php?post_type=rights&category=$matches[1]&paged=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘rights/category/(.+)/?$’ , ‘index.php?post_type=rights&category=$matches[1]’ , ‘top’ ); } In order to add the correct rewrite rule I would need the code of … Read more

Order custom taxonomy by date

WordPress has no an archvie for a taxonomy, but only archive for terms. E.g., you can have the url example.com/series/series-about-fish thta displays all the post in that series, but there is no an archive example.com/series/ that display the posts in all the series. Easiest way to achieve this is create a page template, create a … Read more