Articles of custom taxonomy

Is slug “type” reserved and can't be used in taxonomy rewrite?

I desperately need your help guys. I am trying to register custom post type and taxonomy the following way: add_action( ‘init’, ‘product_catalog’ ); add_action( ‘init’, ‘product_type’, 0 ); function product_catalog() { $labels = array( ‘name’ => _x( ‘Catalog’, ‘post type general name’ ), ‘menu_name’ => ‘Catalog’ ); $args = array( ‘labels’ => $labels, ‘description’ => […]

Is it possible to get a Previous/Next Taxonomy term archive URL?

I have a custom post type called shows and taxonomy called podcast. Using taxonomy-podcast.php, I having hard time finding a function that will generate next/previous Term URL Archive. For Example: URL: Example Term 2 post 1,post 2,post 3 Desired output < Previous Term( . . . . . | . . . . . […]

Custom taxonomy template for multiple custom post types

I’ve registered a custom taxonomy for 3 custom post types to share, this all works fine. My issue at the moment is defining a conditional statement within the custom taxonomy file. I want this taxonomy-{taxonomy}.php file to output different html depending on which custom post type the user is viewing. However, the taxonomy-{taxonomy}.php file seems […]

If statement within PHP echo

I have the following to display my list of categories: $categories = get_categories( $args ); foreach ( $categories as $category ) { echo ‘<li><img src=””/><a href=”‘ . get_category_link( $category->term_id ) . ‘” rel=”bookmark”>’ . $category->name . ” . ” . $category->description . ‘</a></li>’; } But I am using the “categories images” plugin to assign an […]

Set object terms not working on plugin activation

I am trying to create a couple of custom posts and set a custom taxonomy term to it on plugin activation. I am using the register plugin activation hook to do it. The posts are created properly, but I the post term is not being set. I am using wp_set_object_terms to do it. What could […]

How to output wordpress custom tags separated by comma?

Based on a few references I’ve built a function to output a list of custom taxonomy terms separated by comma. The code works as intended, where food_tag is the custom taxonomy I registered for a custom post_type. Here’s the function: function get_taxonomy_food_tags(){ $terms = get_terms(‘food_tag’); foreach($terms as $term){ // The $term is an object, so […]

Querying Term Posts in Loop

I’m trying to show my CPT Category along with any posts associated with it below the title. I have the first loop fine: <?php $cats = get_categories(array(‘taxonomy’ => ‘custtax’, ‘orderby’ => ‘term_group’)); if(!empty($cats)) : foreach($cats as $cat) : ?> <a href=”<?php echo get_category_link($cat->term_id); ?>”><?php echo $cat->name; ?></a> <br /> <?php wp_reset_query(); ?> <?php $cat_posts = […]

Operations with custom fields values in a loop

I have a foreach for displaying all the post in one taxonomy filter by terms. I have a custom field for display a numeric value. What I need, is to make two math operation with all the values of that field, across all post in that term. I mean: Taxonomy X has 4 terms. Each […]

What's the purpose of 'taxonomies' parameter in register_post_type()?

As mentioned in register_post_type() Codex page: taxonomies (array) (optional) An array of registered taxonomies like category or post_tag that will be used with this post type. This can be used in lieu of calling register_taxonomy_for_object_type() directly. Custom taxonomies still need to be registered with register_taxonomy(). Default: no taxonomies In my Custom Post Type (product) I’m […]

Display empty taxonomy terms with get_terms()

I have a function setup as follows: <?php $terms = get_terms(“wpsc_product_category”); if ( !empty( $terms ) && !is_wp_error( $terms ) ){ foreach ( $terms as $term ) { ?> <li class=”calendar-filter-menu-item” data-filter=”.<?php echo $term->slug; ?>”><?php echo $term->count; ?></li> <?php } } ?> Which displays the taxonomy slug and count for each taxonomy, only problem is […]