2011-09-20 129 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

你能解释一下'这个'是什么,以及为什么它对问题有帮助?另外,包括它的用法的一个例子? –