Php 如何在wordpress中为特定页面创建单独的页眉
我制作了一个自定义php头文件,将其命名为header-membersclub.php,并用page.php中的以下代码替换了默认头行: 但由于某些原因,它不起作用。有人能帮我吗?我不知道我做错了什么。我更新了您的代码:Php 如何在wordpress中为特定页面创建单独的页眉,php,wordpress,Php,Wordpress,我制作了一个自定义php头文件,将其命名为header-membersclub.php,并用page.php中的以下代码替换了默认头行: 但由于某些原因,它不起作用。有人能帮我吗?我不知道我做错了什么。我更新了您的代码: <?php if(is_page($post->ID)) { //checking the current post not only 7 get_header('membersclub'); } else { get_header(); }
<?php
if(is_page($post->ID)) { //checking the current post not only 7
get_header('membersclub');
} else {
get_header();
}
?>
我取下了头;这是它应该放在里面的东西。你的问题要更具体一些,包括代码示例也要提供屏幕截图,因为它可以更好地了解你在哪里实现这一点以及你的整个WordPress布局结构。试着把它发布到
<?php
if(is_page($post->ID)) { //checking the current post not only 7
get_header('membersclub');
} else {
get_header();
}
?>