我已经创建了一个post类型,我正在尝试为该post类型创建一个页面,我正在创建一个名为single-job.php
它正在使用index.php
作为模板。下面是我创建帖子类型的函数:
add_action( \'init\', \'register_cpt_job\' );
function register_cpt_job() {
$labels = array(
\'name\' => _x( \'Job posts\', \'job\' ),
\'singular_name\' => _x( \'Job post\', \'job\' ),
\'add_new\' => _x( \'Add New\', \'job\' ),
\'add_new_item\' => _x( \'Add New Job post\', \'job\' ),
\'edit_item\' => _x( \'Edit Job post\', \'job\' ),
\'new_item\' => _x( \'New Job post\', \'job\' ),
\'view_item\' => _x( \'View Job post\', \'job\' ),
\'search_items\' => _x( \'Search Job posts\', \'job\' ),
\'not_found\' => _x( \'No job posts found\', \'job\' ),
\'not_found_in_trash\' => _x( \'No job posts found in Trash\', \'job\' ),
\'parent_item_colon\' => _x( \'Parent Job post:\', \'job\' ),
\'menu_name\' => _x( \'Job posts\', \'job\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => true,
\'supports\' => array( \'title\', \'editor\' ),
\'taxonomies\' => array( \'category\' ),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'has_archive\' => true,
\'query_var\' => true,
\'can_export\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\'
);
register_post_type( \'job\', $args );
}