我想在每个页面上显示一个div,但不想在frontpage上显示。为此,我在函数中使用了以下代码。php
if (! is_front_page()) :
\'<div class="button-kontakt"> <a href="/kontakt"><p>ANFRAGE</p></a></div>\';
endif;
但我的代码不起作用?未显示div。有人能帮我吗?顺致敬意,
汤姆
我想在每个页面上显示一个div,但不想在frontpage上显示。为此,我在函数中使用了以下代码。php
if (! is_front_page()) :
\'<div class="button-kontakt"> <a href="/kontakt"><p>ANFRAGE</p></a></div>\';
endif;
但我的代码不起作用?未显示div。有人能帮我吗?顺致敬意,
汤姆
您需要告诉PHP回显div。
if (! is_front_page()) :
echo \'<div class="button-kontakt"> <a href="/kontakt"><p>ANFRAGE</p></a></div>\';
endif;
此外,您是否已通过“外观->自定义”菜单中的选项将不想看到的页面设置为首页?
请尝试以下代码:
if ( ! is_front_page() && ! is_page( \'home\' ) && ! is_home() ) :
echo \'<div class="button-kontakt"> <a href="/kontakt"><p>ANFRAGE</p></a></div>\';
endif;
或 if ( ! is_front_page() && ! is_page( \'home\' ) && ! is_home() ) : ?>
<div class="button-kontakt"> <a href="/kontakt"><p>ANFRAGE</p></a></div>
<?php endif;
我想加载一些特定的css来更改WP首页/主页的主体元素的颜色。在我的主题函数文件中,以下代码似乎有效,但有人能告诉我它是否“正确”吗?//Adding and Encuing styles for Front Page add_action( \'template_redirect\', \'front_page_design\' ); function front_page_design(){ if ( is_front_page() || is_home())