7
Hello I’m trying to reach the following url structure for the post personalizado
portifolio
:
- website.com/portifolio - Display all posts - OK
- website.com/portifolio/Slug - Displays the portifolio item with Slug
slug
- OK - website.com/portifolio/tags - List all posts related tags - does not work
- website.com/portifolio/tags/Slug - Displays all posts tagged with Slug
slug
- OK
The tag here is a custom taxonomy
, custom taxonomy created for the portifolio
Someone has done this successfully and can give me some example?
My code is like this:
register_taxonomy(
'portfolio_tags',
'portfolio', //post type name
array(
'labels' => array(
'name' => 'Tags'
),
'hierarchical' => false,
'rewrite' => array(
'slug' => 'portfolio/tags'
),
)
);
register_post_type( 'portfolio',
array(
'labels' => $labels,
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-portfolio',
'menu_position' => 5,
'rewrite' => array(
'slug' => 'portfolio',
'with_front' => false
)
)
);
You created a template for this
custom taxonomy
?– Caio Felipe Pereira
yes, to display the call
arquivo
of taxonomy this ok, I just wanted a page that was the index, where lists all categories.– Alan Rezende