I have created custom post type with 'members'
<?php
$member = new CPT(array(
'post_type_name' => 'members',
'singular' => __('Members', 'c2s'),
'plural' => __('Members', 'c2s'),
'slug' => 'Members'
),
array(
'supports' => array('title', 'editor', 'thumbnail', 'comments'),
'menu_icon' => 'dashicons-groups'
));
$member->register_taxonomy(array(
'taxonomy_name' => 'members_tags',
'singular' => __('Members Tag', 'c2s'),
'plural' => __('Members Tags', 'c2s'),
'slug' => 'member-tag'
));
?>
I am trying to print/display members_tags into the individual post.
I have created custom post type with 'members'
<?php
$member = new CPT(array(
'post_type_name' => 'members',
'singular' => __('Members', 'c2s'),
'plural' => __('Members', 'c2s'),
'slug' => 'Members'
),
array(
'supports' => array('title', 'editor', 'thumbnail', 'comments'),
'menu_icon' => 'dashicons-groups'
));
$member->register_taxonomy(array(
'taxonomy_name' => 'members_tags',
'singular' => __('Members Tag', 'c2s'),
'plural' => __('Members Tags', 'c2s'),
'slug' => 'member-tag'
));
?>
I am trying to print/display members_tags into the individual post.
Share Improve this question asked Aug 3, 2017 at 6:24 Rabin RaiRabin Rai 11 silver badge2 bronze badges 1- Possibly using the WP Custom Post Type Class which is now PostTypes by Joe Grainger – admcfajn Commented Nov 9, 2018 at 7:09
1 Answer
Reset to default 2You can use get_the_term_list()
to output a list of links:
<?php echo get_the_term_list( get_the_ID(), 'members_tags', '', ',' ); ?>
That will output a comma-separated list of links to attached member_tags
.
If you want the raw tags so you have more control over HTML, use get_the_terms()
<?php $member_tags = get_the_terms( get_the_ID(), 'members_tags' ); ?>