WordPress自定义帖子类型分类
我正在处理自定义帖子类型,但我面临的问题是它需要通常的帖子分类。现在得到重写,但无法以正确的方式获得分类结构。WordPress自定义帖子类型分类
面包屑只是表明:
首页>新闻中心>项目代替首页> 1>文件>项目。
我尝试这样做:
'taxonomies' => array('Page 1', 'Archive'),
但是什么都没有发生。
不知道这是你需要或意思,但在这里工作好什么:
<?php
/*
Plugin Name: Page 1 Post Type
Plugin URI:
Author:
Author URI:
Version: 0.1
Description:
License: GPL2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
function codex_custom_init() {
$labels = array(
'name' => 'Page 1s',
'singular_name' => 'Page 1',
'add_new' => 'Add New',
'add_new_item' => 'Add New Page 1',
'edit_item' => 'Edit Page 1',
'new_item' => 'New Page 1',
'all_items' => 'All Page 1s',
'view_item' => 'View Page 1',
'search_items' => 'Search Page 1s',
'not_found' => 'No Page 1s found',
'not_found_in_trash' => 'No Page 1s found in Trash',
'parent_item_colon' => '',
'menu_name' => 'Page 1s'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array('slug' => 'Page1'),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'supports' => array('title', 'editor', 'revisions', 'page-attributes')
);
register_post_type('Page 1', $args);
}
add_action('init', 'codex_custom_init');
?>
试过了,没有成功。我的意思是,分类法选择“页面1”作为我的自定义帖子类型的父项。我有重写已经工作。 –
http://wordpress.stackexchange.com/questions/1354/adding-categories-to-a-wordpress-custom-post-type – theode
为了消除在导航条的“新闻”的项目,你需要从删除此重写您的自定义帖子类型。试试这个=
'rewrite' => array('slug' => 'Page1', 'with_front' => false),
正如它的名字所暗示的,每次创建新的自定义后类型时,它会创建它作为后,默认情况下你的WordPress站点内所有职位的博客/新闻中列出页面,因此他们为什么会出现在你的面包屑中。
这可能不会完全解决您的问题,因为我认为您还需要对面包屑进行一些格式化 - 这是面包屑管理的一个很好的插件,并提供了很多可自定义的设置! = http://wordpress.org/plugins/breadcrumb-navxt/
您是否尝试在后端重新保存您的固定链接设置? – Kortschot
或检查:http://generatewp.com可能会有所帮助。如果你展示更多信息,人们可以给出更好的建议。 – Kortschot
@Kortschot这与核心永久链接无关。这是一个自定义的固定链接。 –