我为我的WordPress的网站使用景观主题(https://en-gb.wordpress.org/themes/landscape/)。 问题是,当我需要的是中殿酒吧菜单时,标题叠加图像被附加到导航栏菜单。在主页上没问题,但它也出现在其他所有页面上,这是不必要的。 我试图用一个if条件:WordPress的 - 如何删除标题覆盖
<?php if (is_home()) { ?>
<div class="header-overlay">
<div class="site-branding">
<h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></h1>
<h2 class="site-description"><?php bloginfo('description'); ?></h2>
</div>
</div>
<?php } ?>
但没有奏效。
任何人都可以帮助如何从代码中删除它?
的header.php:
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<div class="site-branding">
<a href="http://localhost/abba_property_services/"><img src="http://localhost/abba_property_services/wp-content/uploads/2017/03/ABBA-Solutions-White-Background-1.png"></a>
</div>
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e('Skip to content', 'landscape'); ?></a>
<header id="masthead" class="site-header" role="banner">
<nav role="navigation" class="site-navigation main-navigation">
<h1 class="assistive-text"><?php _e('Menu', 'landscape'); ?></h1>
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
</nav><!-- .site-navigation .main-navigation -->
<div class="header-overlay">
<div class="site-branding">
<h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></h1>
<h2 class="site-description"><?php bloginfo('description'); ?></h2>
</div>
</div>
</div>
</header>
的header.php
这工作就像一个魅力!非常感谢! –
还有一个空白区域,标题叠加图像将位于所有其他页面上。有没有办法摆脱它? –
@ T.Doe你为什么要删除你的问题?我想回答它..): –