I created a custom post type called members:
// Custom post types
function members_post_type()
{
$args = array(
'labels' => array(
'name' => 'Members',
'singular_name' => 'Member',
'all_items' => 'All members'
),
// 'hierarchical' => true,
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor' , 'thumbnail'),
'menu_icon' => 'dashicons-groups'
);
register_post_type('members', $args);
}
add_action('init', 'members_post_type');
function members_taxonomys()
{
$args = array(
'public' => true,
'hierarchical' => true
);
register_taxonomy('Categories', array('members'), $args);
}
add_action('init', 'members_taxonomys');
<?php if(have_posts()):?>
<?php while(have_posts() ): ?>
<?php
the_category(' ');
?>
And for some reason, it didn't work. Feel free to ask more questions or more details.
Comments
Create a new members post and assign your custom taxonomy to it
Then you need to replace the
the_category();
function because it works with the standard category taxonomy, you need to use get_the_terms functionAdd Comment