我已经创建了一个页面,其中包含一些文本,使用此页面关于。php作为模板;第页关于。php包含基本的:
<?php /* Template Name: About us */
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php
while ( have_posts() ) : the_post(); the_content();
endwhile;
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
我真正不理解的是,如果我创建另一个页面,比如说辅导,分配页面辅导。php将其作为模板,页面指导。php的内容与上面的内容相同,但模板名为/*Coaching*/,当然,当我查看页面时,会显示主页的内容吗?而且教练也从菜单上消失了?!
这快把我逼疯了,有什么建议吗?
我已经为这两个部分创建了自定义的帖子类型,完全相同,只是即将从一个部分变成另一个部分,如下所示:
// Custom post type => ABOUT US
add_action( \'init\', \'create_about\' );
function create_about() {
$labels = array(
\'name\' => _x(\'About us\', \'post type general name\'),
\'singular_name\' => _x(\'About us\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'About us\'),
\'add_new_item\' => __(\'Add New About us\'),
\'edit_item\' => __(\'Edit About us\'),
\'new_item\' => __(\'New About us\'),
\'view_item\' => __(\'View About us\'),
\'search_items\' => __(\'Search About us\'),
\'not_found\' => __(\'No About us found\'),
\'not_found_in_trash\' => __(\'No About us found in Trash\'),
\'parent_item_colon\' => \'\'
);
$supports = array(\'title\', \'editor\', \'revisions\', \'excerpt\', \'thumbnail\', \'page-attributes\');
register_post_type( \'about\',
array(
\'labels\' => $labels,
\'public\' => true,
\'has_archive\' => true,
\'hierarchical\' => true,
\'query_var\' => true,
\'supports\' => $supports
)
);
}