我制作了一个自定义的php头文件,并将其命名为header-membersclub.php
,并使用page.php
中的此代码替换了默认标题行:
<?php
if(is_page(7)) {
get_header('membersclub');
} else {
get_header();
}
wp_head();
?>
但由于某种原因,它不起作用。有人可以帮我这个吗?我不知道我做错了什么。
答案 0 :(得分:1)
我更新了您的代码:
<?php
if(is_page($post->ID)) { //checking the current post not only 7
get_header('membersclub');
} else {
get_header();
}
?>
我删除了wp_head();
内的<head>
。