Portfolio category as slug – WordPress

I’m learning php & wordpress but this escapes from my knowledge. I have a portfolio theme that I want to separate for SEO pourposes.

I have this. (productos is the current portfolio slug)

Read More
website.com/productos/portfoliopost1 (category-a slug)

website.com/productos/portfoliopost2 (category-b slug)

But this is that I want to show:

website.com/category-a/portfoliopost1 (category-a slug)

website.com/category-b/portfoliopost2 (category-b slug)

It’s possible? Thanks for all.
This is the current portfolio.php that generate the slug.

if ( !function_exists( 'pexeto_register_portfolio_post_type' ) ) {

/**
 * Registers the portfolio custom type.
 */
function pexeto_register_portfolio_post_type() {

    //the labels that will be used for the portfolio items
    $labels = array(
        'name' => _x( 'Portfolio', 'portfolio name', 'pexeto_admin' ),
        'singular_name' => _x( 'Portfolio Item', 'portfolio type singular name', 'pexeto_admin' ),
        'add_new' => _x( 'Add New', 'portfolio', 'pexeto_admin' ),
        'add_new_item' => __( 'Add New Item', 'pexeto_admin' ),
        'edit_item' => __( 'Edit Item', 'pexeto_admin' ),
        'new_item' => __( 'New Portfolio Item', 'pexeto_admin' ),
        'view_item' => __( 'View Item', 'pexeto_admin' ),
        'search_items' => __( 'Search Portfolio Items', 'pexeto_admin' ),
        'not_found' =>  __( 'No portfolio items found', 'pexeto_admin' ),
        'not_found_in_trash' => __( 'No portfolio items found in Trash', 'pexeto_admin' ),
        'parent_item_colon' => ''
    );

    //register the custom post type
    register_post_type( PEXETO_PORTFOLIO_POST_TYPE,
        array( 'labels' => $labels,
            'public' => true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'rewrite' => array( 'slug'=> 'productos', 'with_front' => false ),
            'taxonomies' => array( PEXETO_PORTFOLIO_TAXONOMY ),
            'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'page-attributes' ) ) );

}}

Related posts

1 comment

Comments are closed.