2012-10-13 68 views
0

所以我使用的是自定義主題,並希望我們的文章創建一個自定義URL結構.. 基本上,一個我有現在的問題是 - > site.com/article/文章 - 塞 ,我需要有一個固定鏈接像這樣site.com/category-slug/article/article-slug添加類別自定義文章類型永久

我使用的代碼是:

register_taxonomy('article', 'article_type', array( 
'labels' => array(
    'name' => 'Article Categories' , 
    'singular_name' => _x('Article Category', 'taxonomy singular name'), 
    'search_items' => __('Search Article Categorys'), 
    'popular_items' => __('Popular Article Categorys'), 
    'all_items' => __('All Article Categorys'), 
    'parent_item' => null, 
    'parent_item_colon' => null, 
    'edit_item' => __('Edit Article Category'), 
    'update_item' => __('Update Article Category'), 
    'add_new_item' => __('Add Article Category'), 
    'new_item_name' => __('New Article Category Name'), 
    'separate_items_with_commas' => __('Separate Article Categorys with commas'), 
    'add_or_remove_items' => __('Add or remove Article Categorys'), 
    'choose_from_most_used' => __('Choose from the most used Article Categorys') 
    ) , 
'hierarchical' => true, 
'query_var' => true, 
'show_ui' => true, 
'rewrite' => array('slug' => 'article-category'))); 
register_post_type('article_type', 
    array(
     'labels' => array('name' => 'Article Manager', 'singular_name' => 'Articles'), 
    'query_var' => true, 
'show_ui' => true, 
    'public' => true, 
    'hierarchical' => true, 
    'rewrite' => array('slug' => 'article','with_front' => TRUE),    
    'supports' => array ('title', 'editor','author', 'custom-fields', 'revisions', 'post-formats', 'trackbacks', 'comments','excerpt'), 
     'menu_icon' => get_template_directory_uri()."/PPT/img/admin/article.png", 

    ) 
); 
+0

你就不能進入設置>固定鏈接和更改設置的物品類別%%/%postname%? – coopersita

+0

No..its沒有這麼簡單..它不工作 – maidabarrientos

+0

**這裏的解決方案!!!!!!!!!!!!!!!!!!!!!!!!!!! **:http://wordpress.stackexchange.com/a/167992/33667 –

回答

0

關於設置什麼>固定鏈接和/%category%/%taxonomy%/postname%/

相關問題