TemplatesEverywhere 为自定义帖子类型提供独特模板支持
TemplatesEverywhere 为您的自定义帖子类型提供高度灵活的模板设置。要实现这一功能,只需将 pmg:templates
支持项添加到您的帖子类型即可。这可以在帖子类型注册时或在注册后添加。以下是具体操作步骤:
1. 在注册期间添加模板支持:
add_action ( 'init' , function () {
register_post_type ( 'some_type' , array (
'supports' => array ( 'title' , 'editor' , 'pmg:templates' ),
));
});
2. 注册后添加模板支持:
add_action ( 'init' , function () {
add_post_type_support ( 'some_type' , 'pmg:templates' );
});
以上代码块帮助您在不同阶段灵活添加 pmg:templates
支持,让自定义帖子类型的模板管理更加简单高效。
下载地址
用户评论