Hello, I'm trying to reach the following url structure for post personalizado
portifolio
:
- website.com/portifolio - Displays all posts - OK
- website.com/portifolio/slug - Displays the portlet item with slug
slug
- OK - website.com/portifolio/tags - List all tags related to post type - 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 portifolio
Has anyone done this successfully and can you give me some examples?
My code looks 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
)
)
);