TheImaginative
TheImaginative

Reputation: 77

How do I use conditional tags to place an object on all pages other than the front page?

I am trying to place a "back to home" button on all of the pages except the home page on a Wordpress site. I have successfully placed the item on all pages but cannot figure out how to remove it from the home page. I know that I probably need to use conditional tags but haven't worked with them much.

Here is the code I used in 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>

What would I need to use to have the image not on the homepage?

Any help in how to do this would be great! Thanks!

Here is the link to the site: http://s416809079.onlinehome.us/

Upvotes: 0

Views: 204

Answers (2)

s_ha_dum
s_ha_dum

Reputation: 2850

Use is_home() or is_front_page(). Which works depends on some peculiarities of your theme and your configuration. You'd have:

<?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
} ?>

Or the same with is_front_page().

Upvotes: 1

Marin Sagovac
Marin Sagovac

Reputation: 3982

You should change of parameter CSS data in CSS files for property .outer.

div.outer img
{
    width: 300px;
    height: 300px;
    float: left;
    left: 10px;
    top: 10px;
}

Upvotes: 0

Related Questions