这就是我创建自定义帖子类型的方式
function wp_custom_post_type_listing()
{
$labels = array(
\'name\' => _x(\'Listing\', \'post type general name\', \'wpprolister\'),
\'singular_name\' => _x(\'Listing\', \'post type singular name\' ,\'wpprolister\'),
\'add_new\' => _x(\'Add new listing\', \'l\', \'wpprolister\'),
\'all_item\' => __(\'All Listing\', \'wpprolister\'),
\'add_new_item\' => __(\'Add new listing\', \'wpprolister\'),
\'edit_item\' => __(\'Edit Listing\', \'wpprolister\'),
\'new_item\' => __(\'New Listing\', \'wpprolister\'),
\'view_item\' => __(\'View Listing\', \'wpprolister\'),
\'search_item\' => __(\'Search Listing\', \'wpprolister\'),
\'not_found\' => __(\'No Listing found\', \'wpprolister\'),
\'not_found_in_trash\' => __(\'No listings found in trash\', \'wpprolister\'),
\'parent_item_colon\' => __(\'Parent Listing\', \'wpprolister\'),
);
$args_listing = array(
\'labels\' => $labels,
\'public\' => true,
\'has_archive\' => true,
\'publicly_queryable\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'menu_icon\' => plugins_url( \'images/list.png\', __FILE__ ),
\'capability_type\' => \'listing\',
\'capabilities\' => array(
\'edit_post\' => \'edit_listing\',
\'read_post\' => \'read_listing\',
\'delete_post\' => \'delete_listing\',
\'edit_posts\' => \'edit_listings\',
\'edit_others_posts\' => \'edit_others_listings\',
\'publish_posts\' => \'publish_listings\',
\'read_private_posts\' => \'read_private_listings\',
\'create_posts\' => \'edit_listings\',
\'delete_posts\' => \'delete_listings\',
\'delete_published_posts\' => \'delete_published_listing\',
\'delete_others_posts\' => \'delete_others_listings\',
\'edit_published_posts\' => \'edit_published_listings\',
),
\'hierarchical\' => false,
\'map_meta_cap\' => false,
\'supports\' => array(
\'title\',
\'editor\',
\'expert\',
\'thumbnail\',
\'comments\',
\'page-attributes\',
),
\'taxonomies\' => array(\'listing_categories\', \'locations\', \'amenities\', \'post_tag\'),
\'menu_position\' => 2,
\'exclude_from_search\' => false,
);
register_post_type(\'l\', $args_listing);
}
但用于选择帖子模板的帖子属性不会显示。我在模板中添加了
page-fullwidth.php
<?php if ( ! defined( \'ABSPATH\' ) ) exit;
/*
Template Name: Full Width
Template Post Type: post, page , l
*/
get_header();
get_template_part( \'/wpprolister-templates/content\', \'titlebar\'); ?>
我已经为自定义帖子类型分配了模板
single-l.php
但我想要一个额外的帖子模板