2011-09-20 130 views
1

從Wordpress中的URL中刪除分類基礎時遇到了一些問題。我嘗試了不同的方法,但沒有工作。從WordPress中刪除基於URL的分類基礎

register_taxonomy('project_category','projects',array(
    'labels' => $labels, 
    'show_ui' => true, 
    'rewrite' => array(
     'slug' => 'project-category', 
     'with_front' => false, 
     'hierarchical' => true), 
    'hierarchical' => true) 
); 

我目前看到的網址是這樣的:http://mysite.com/project-category/project1,我想它是這樣的:http://mysite.com/project1

我試圖改寫slug爲''而不是'項目類',但這與我所有的其他頁面混淆,重定向到404頁面。

+0

有人嗎?一個辦法? – sticksu

+0

真的嗎?沒有人知道如何做到這一點?... – sticksu

回答

0

繼承人如何設法讓我的網址rewirte到spicific網址。

add_action('init', 'portfolio_register'); 

function portfolio_register() { 
$args = array( 
    'label' => __('Portfolio'), 
    'singular_label' => __('Project'), 
    'public' => true, 
    'show_ui' => true, 
    'capability_type' => 'post', 
    'hierarchical' => false, 
    'rewrite' => true, 
    'supports' => array('title', 'editor', 'thumbnail') 
    ); 

register_post_type('portfolio' , $args); 
} 

register_taxonomy(
    "project-type", 
    array("portfolio"), 
    array("hierarchical" => true, 
    "label" => "Project Types", 
    "singular_label" => "Project Type", 
    "rewrite" => true 
)); 

還檢查了一些教程,有時你可以搶位從主題&件。

  1. Wordpress custom post types
  2. Rock solid wordpress 3.0 post types
  3. Custom post type tools & advice
0

嘗試this

只需拖放到wp-content/plugins並激活。它正在被添加到WP存儲庫中。

+0

你能解釋一下'這個'是什麼,以及爲什麼它對問題有幫助?另外,包括它的用法的一個例子? –