我正在處理自定義帖子類型,但我面臨的問題是它需要通常的帖子分類。現在得到重寫,但無法以正確的方式獲得分類結構。WordPress自定義帖子類型分類
麪包屑只是表明:
首頁>新聞中心>項目代替首頁> 1>文件>項目。
我嘗試這樣做:
'taxonomies' => array('Page 1', 'Archive'),
但是什麼都沒有發生。
我正在處理自定義帖子類型,但我面臨的問題是它需要通常的帖子分類。現在得到重寫,但無法以正確的方式獲得分類結構。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這與核心永久鏈接無關。這是一個自定義的固定鏈接。 –