[英]Wordpress Theme Access Pages
我正在修改wordpress主题以具有移动菜单。 但是,我对WP或PHP没有太多经验,因此我需要您告诉我WP用于访问顶部栏中页面的功能/代码。 另外,我应该修改哪个文件? (主题是Vantage)
您可以编辑位于的header.php
wp-content/themes/vantage/header.php
这是我为项目编写的gist.github.com上的函数
function get_current_template_name($return = FALSE) {
$files = get_included_files();
$templateIndex = (count($files)-2);
$string = $files[$templateIndex];
$templateName = end(explode(DIRECTORY_SEPARATOR, $string));
if($return) return $templateName;
else echo $templateName;
}
// Calling | this will print the current template name
get_current_template_name();
// Calling with Bool Param
$tmpl_file = get_current_template_name(TRUE);
if($tmpl_file == 'page.php') echo "this page is using default page template";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.