我知道如何定义自定义帖子模板vai插件非常容易,但我想没有插件,我如何定义特定类别帖子的自定义帖子模板。
比如说我有一个类别“会员”,在这个类别下有十个帖子。所以我想当显示这些成员张贴的时候显示自定义模板。
请参阅“二十一二”主题类别中的以下代码。php文件
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
/* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( \'content\', get_post_format() );
endwhile;
twentytwelve_content_nav( \'nav-below\' );
?>
<?php else : ?>
<?php get_template_part( \'content\', \'none\' ); ?>
<?php endif; ?>
参见上述代码get_template_part( \'content\', get_post_format() );
并查看get_template_part( \'content\', \'none\' )
现在我想当“成员”类别的帖子将打开它将一个自定义页面。。喜欢content-members.php
文件,所以我认为代码应该是这样的get_template_part( \'content\', \'members\' )
那么如何在分类页面中定义成员分类帖子将打开内容成员。php文件