這聽起來像是你想要一個Custom Post Type。這應該像普通的帖子或頁面一樣運行,但具有自己的索引頁面和後端管理屏幕。您需要使用register_post_type
來創建帖子類型。之後,事情大都是自動的。從食品,作爲參考:
function codex_custom_init() {
$labels = array(
'name' => 'Books',
'singular_name' => 'Book',
'add_new' => 'Add New',
'add_new_item' => 'Add New Book',
'edit_item' => 'Edit Book',
'new_item' => 'New Book',
'all_items' => 'All Books',
'view_item' => 'View Book',
'search_items' => 'Search Books',
'not_found' => 'No books found',
'not_found_in_trash' => 'No books found in Trash',
'parent_item_colon' => '',
'menu_name' => 'Books'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array('slug' => 'book'),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments')
);
register_post_type('book', $args);
}
add_action('init', 'codex_custom_init');
的參數可以是有點混亂。 Smashing Magazine has a post that should help。
好像你想要一個自定義帖子類型,但也是一個160的摘要只顯示160個字符? – 2013-03-14 14:14:10
@DavidChase感謝您的評論,它不是強制性的只有160個字符,我只是想指出它將是短文本,或多或少的160個字符:) – Abude 2013-03-14 14:24:06
您是否在您的網站的任何其他地方使用了帖子?如果不是,你可以使用這些?否則,請使用下面建議的自定義帖子類型。 – user2019515 2013-03-14 18:57:49