Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用条件标记将对象放置在除首页以外的所有页面上?_Php_Html_Image_Wordpress_If Statement - Fatal编程技术网

Php 如何使用条件标记将对象放置在除首页以外的所有页面上?

Php 如何使用条件标记将对象放置在除首页以外的所有页面上?,php,html,image,wordpress,if-statement,Php,Html,Image,Wordpress,If Statement,我试图在除了Wordpress网站的主页之外的所有页面上放置一个“返回主页”按钮。我已成功将该项目放置在所有页面上,但无法确定如何将其从主页中删除。我知道我可能需要使用条件标记,但没有太多使用它们 以下是我在header.php中使用的代码: <div class="outer"><a href="http://s416809079.onlinehome.us/"><img src="http://theshalomimaginative.com/testsite/

我试图在除了Wordpress网站的主页之外的所有页面上放置一个“返回主页”按钮。我已成功将该项目放置在所有页面上,但无法确定如何将其从主页中删除。我知道我可能需要使用条件标记,但没有太多使用它们

以下是我在header.php中使用的代码:

<div class="outer"><a href="http://s416809079.onlinehome.us/"><img src="http://theshalomimaginative.com/testsite/wp-content/themes/pilot-fish/images/Untitled-1.png"/></a></div>

我需要使用什么才能使图像不在主页上

任何关于如何做到这一点的帮助都将是巨大的!谢谢


以下是该站点的链接:

您应该更改属性
的CSS文件中的参数CSS数据

div.outer img
{
    width: 300px;
    height: 300px;
    float: left;
    left: 10px;
    top: 10px;
}
使用或。这取决于主题和配置的某些特性。你应该:

<?php
if (!is_home()) { ?>
    <div class="outer"><a href="http://s416809079.onlinehome.us/"><img src="http://theshalomimaginative.com/testsite/wp-content/themes/pilot-fish/images/Untitled-1.png"/></a></div><?php
} ?>


或者与
is\u front\u page()

相同,我希望图像出现在除首页以外的所有页面上。这就是我困惑的地方。除了头版之外,是否还有其他内容的条件标签?或者我可以使用首页标签,让它不显示图像吗。。。很抱歉我知道这一点,但还是做错了。只需在条件中添加一个负数。我将在我的第一篇文章中编辑代码。非常感谢你!您是如何将负数添加到条件中的?感叹号是一个“否定”运算符。这些函数返回布尔值(true或false),因此在前面加一个感叹号将反转该值。如果
为home()
true
!is_home()
is
false