我在 WordPress 中使用popularfx 的 waymore 主题,并且想要更改我的“关于”和“服务”页面中的标题图像。
目前,所有页面上都显示相同的标题图像,但我希望在“关于”和“服务”页面上显示不同的标题横幅
我在 wp-content/theme/popularfx/header-about.php 创建了 header-about.php
并更改了 page.php 中的代码
<?php
if(is_page('about'))
{
get_header('about');
}
else
{
get_header();
}
wp_head();
?>
但是这段代码根本不起作用。
我还尝试了不同的插件来实现相同的独特标题、wp 标题图像等
在 page.php 上,尝试以下操作:
<?php
if ( is_page('about') ) {
get_header('about');
} elseif ( is_page('service') ) {
get_header('service');
} else {
get_header();
}
?>
如果您想自定义两个标头,请确保相应页面都有 header-about.php 和 header-service.php。 get_header('about') 将调用 header-about.php。
另外,请确保检查页面 slug 是否为“about”,例如 www.site-url.com/about 表示 is_page('about')。或者,检查“设置”>“永久链接”中的“永久链接”设置,以适当地更改“永久链接”设置。