我爲我的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你爲什麼要刪除你的問題?我想回答它..): –