0

This should be fairly simple and Im not sure what I'm doing wrong. I am trying to display the tags associated with my custom post.

I have registered it like so

// Initialize Taxonomy Labels
    $labels = array(
        'name' => _x( 'Tags', 'taxonomy general name' ),
        'singular_name' => _x( 'Tag', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Types' ),
        'all_items' => __( 'All Tags' ),
        'parent_item' => __( 'Parent Tag' ),
        'parent_item_colon' => __( 'Parent Tag:' ),
        'edit_item' => __( 'Edit Tags' ),
        'update_item' => __( 'Update Tag' ),
        'add_new_item' => __( 'Add New Tag' ),
        'new_item_name' => __( 'New Tag Name' ),
    );

    // Register Custom Taxonomy
    register_taxonomy('tagevents',array('events'), array(
        'hierarchical' => true, // define whether to use a system like tags or categories
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'tag-events' ),
    ));

but I cannot display the tags associated with the single page.

I have tried (among other things) <?php the_tags('<span class="tags-button">Tags : ',' ','</span><br />'); ?> which I use in my posts single page.

1 Answer 1

0

the_tags is only for the post_tag taxonomy, use the_terms to output custom taxonomies with a similar format:

the_terms(
    $post->ID,
    'tagevents',
    '<span class="tags-button">Tags : ',
    ' ',
    '</span><br />'
);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.