0
我有多个标签,并且想要为每个人标签创建多个single.php。通过标签ID或名称为特定标签创建single.php
如何为标签创建single.php?
此代码适用于类别,如何编辑标签?
function my_category_templates($single_template) {
global $post;
if (in_category('raspee')) {
$single_template = dirname(__FILE__) . '/single-raspee.php';
}
return $single_template;
}
add_filter("single_template", "my_category_templates");
在此发布您的问题http://wordpress.stackexchange.com/ – unixmiah
您应该了解[Template Hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/#tag)。 – MinhTri