我正在创建一个新的页面模板(从本质上讲,我是从一个新主题中提取零碎信息)。我已经打过电话了template-flat.php
现在在functions.php
我正在寻找一个条件语句来加载一些新的js和csstemplate-flat.php
而不是旧主题加载的。
我有办法做到这一点吗?
我正在创建一个新的页面模板(从本质上讲,我是从一个新主题中提取零碎信息)。我已经打过电话了template-flat.php
现在在functions.php
我正在寻找一个条件语句来加载一些新的js和csstemplate-flat.php
而不是旧主题加载的。
我有办法做到这一点吗?
您可以使用条件标记is_page_template()
此条件标记允许您确定是否在任何页面模板中。(可选)检查页面中是否正在使用特定的页面模板。这是一个布尔函数,意味着它返回TRUE或FALSE。
你可以试试
if( is_page_template( \'template-flat.php\' ) ) {
//Do something if the current template is template-flat.php
}else{
//Do something else if the current template is not template-flat.php
}
WordPress已经提出了这个问题,但没有答案。我只是想在这个论坛上试试,如果有人知道的话,因为我也有同样的问题。要使用jquery滑块编辑我的主题,如何转到该脚本?,显示“$主题->挂钩(\'content\\u before\');”在content div标记中。有人能帮忙吗?我的主题索引。php包含以下内容<div id=\"main\"> <?php $theme->hook(\'main_before\'); ?> &#x