投资组合类别为slug-Wordpress


Portfolio category as slug - Wordpress

我正在学习php&wordpress,但这是我所不知道的。我有一个投资组合的主题,我想分离SEO pourposes。

我有这个。(productos是当前的投资组合slug)

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

但我想展示的是:

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

有可能吗?谢谢大家。这是生成段塞的当前portfolio.php

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' ) ) );
}}

您可以使用post_type_link挂钩。

在这里你可以找到解释:

WordPress Exchange

WordPress Exchange2