2017-04-18 15 views
0

私は1つの分類でカスタムポストタイプを持っており、これはリンク構造である: mywebsite.com/casos-legal(アーカイブ-casos-legal.phpにポストを表示)書き換えカスタムポストタイプのURL

そして、私はすべてのポストをクリックすると:上記の場合 mywebsite.com/casos-legal/lima/this-is-the-post-title

を、「リマ」は、用語でありますタクソノミーの

「casos-legal」の前にパスを追加する方法はありますか?このような何か: mywebsite.com/temas/legal/casos-legal

と: mywebsite.com/temas/legal/casos-legal/lima/this-is-the-post-title mywebsite.com/temas/legal/casos/lima/this-is-the-post-title

そして、はるかに良いが、このような何かを得るために、単に「casos」のポストスラッグを変更します

ありがとうございます! 名前がMyWebSite:このリンク構造を得るために

function aprodeh_casos_taxonomia(){ 

$labels = array(
    'name' => 'Categorías', 
    'singular_name' => 'Categoría', 
    'search_items' => 'Buscar categoría', 
    'all_items' => 'Todas las categorías', 
    'edit_item' => 'Editar categoría', 
    'update_item' => 'Actualizar categoría', 
    'add_new_item' => 'Agregar categoría', 
    'new_item_name' => 'Nuevo categoría', 
    'menu_name' => 'Categorías', 

); 

$args = array(

    'hierarchical' => true, 
    'labels' => $labels, 
    'show_ui' => true, 
    'show_admin_column' => true, 
    'query_var' => true, 
    'rewrite' => array('slug' => 'casos-legal', 'with_front' => false), 

); 

register_taxonomy('categoria_casos', array('casos-legal'), $args); 

} 

add_action('init', 'aprodeh_casos_taxonomia'); 

そして最後に、このコード:

これは、これはそれが分類をどのように見えるかであるCTP

function aprodeh_casos(){ 

$labels = array(
    'name' => 'Casos - legal', 
    'singular_name' => 'Caso', 
    'add_new' => 'Agregar', 
    'all_items' => 'Todos', 
    'add_new_item' => 'Agregar', 
    'edit_item' => 'Editar', 
    'new_item' => 'Nuevo', 
    'view_item' => 'Ver', 
    'search_item' => 'Buscar', 
    'not_found' => 'No se encontraron casos', 
    'not_found_in_trash' => 'No se encontraron casos en la papelera', 
    'parent_item_colon' => 'Parent Item', 

); 

$args = array(
    'labels' => $labels, 
    'public' => true, 
    'publicly_queryable' => true, 
    'query_var' => true, 
    'rewrite' => array('slug' => '/casos-legal/%categoria_casos%', 'with_front' => false), 
    'has_archive' => 'casos-legal', 
    'capability_type' => 'post', 
    'hierarchical' => false, 
    'supports' => array(
     'title', 
     'editor', 
     'thumbnail', 
    ), 
    'menu_position' => 5, 
    'exclude_from_search' => false, 
    'taxonomies' => array('post_tag'), 
); 
register_post_type('casos-legal',$args); 

} add_action('init','aprodeh_casos'); 

をどのように見えるかです。 com/casos-legal/lima/this-is-the-post-title

答えて

0

'rewrite' => array('slug' => '/tema/legal/casos/%categoria_casos%', 'with_front' => false), 

'rewrite' => array('slug' => '/casos-legal/%categoria_casos%', 'with_front' => false), 

をアップデートしてみてください