Wednesday, June 25, 2014

How to display content or div only on Homepage of wordpress websites

Introduction: In this article today I will explain how we can display content or div only on Homepage of wordpress websites

Description:
Some time in wordpress we have to show content or div only on home page of website.
e.g. I have to show pic/photo in footer only on home page. To fulfill the requirement we can create new home page template(home.php) or simply add a php code in footer.php file of theme. Here I have add the below given code in footer.php file:


<?php if (is_front_page()) { ?>
<img src=""/>
<?php } ?>

You can also CSS style:

<?php if (is_front_page()) { ?>
<div class="footerhome">
<h1 style="font-size:20px">Welcome</h1>
</div>

<?php } ?>

Is this article helpful for you?

If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

No comments:

Post a Comment