我想有自定义的帖子类型,只有标题和存档页,但没有详细信息页。
以下是自定义帖子类型代码:
add_action( \'init\', \'register_cpt_trivia\' );
function register_cpt_trivia() {
$labels = array(
\'name\' => _x( \'Trivia\', \'trivia\' ),
\'singular_name\' => _x( \'Trivia\', \'trivia\' ),
\'add_new\' => _x( \'Add New\', \'trivia\' ),
\'add_new_item\' => _x( \'Add New Trivia\', \'trivia\' ),
\'edit_item\' => _x( \'Edit Trivia\', \'trivia\' ),
\'new_item\' => _x( \'New Trivia\', \'trivia\' ),
\'view_item\' => _x( \'View Trivia\', \'trivia\' ),
\'search_items\' => _x( \'Search Trivia\', \'trivia\' ),
\'not_found\' => _x( \'No trivia found\', \'trivia\' ),
\'not_found_in_trash\' => _x( \'No trivia found in Trash\', \'trivia\' ),
\'parent_item_colon\' => _x( \'Parent Trivia:\', \'trivia\' ),
\'menu_name\' => _x( \'Trivia\', \'trivia\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'description\' => \'Few line text with no detail pages.\',
\'supports\' => array( \'title\' ),
\'public\' => false,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 20,
\'show_in_nav_menus\' => false,
\'publicly_queryable\' => true,
\'exclude_from_search\' => true,
\'has_archive\' => true,
\'can_export\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\'
);
register_post_type( \'trivia\', $args );
}