Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

If any page other than front-page display block HELP

I have the following code for my footer:

<div class="horizontal_rule grid_12 omega">
  <p class="popular_post">Popular Post</p>       
    <hr>
</div>

<div id="popular_post_img">
     <img class="grid_3 alpha" src="images/img_placeholder.gif" width="235" height="250">
     <img class="grid_3" src="images/img_placeholder.gif" width="235" height="250"> 
     <img class="grid_3" src="images/img_placeholder.gif" width="235" height="250"> 
     <img class="grid_3 omega" src="images/img_placeholder.gif" width="235" height="250">
</div>  

<div class="grid_12">
<p class="grid_3 alpha captions">Beauty</p>
<p class="grid_3 captions">Beauty</p>
<p class="grid_3 captions">Beauty</p>
<p class="grid_3 omega captions">Beauty</p>
</div>          

Howevever, when on the any other page except the front-page (aka home page) I want the above blocked (not to show in the footer) any idea what you add to my wordpress/php for this?

1 Answer

If I'm reading this right, you want to have this bit only display on the home page only. If so try this; <?php is_front_page(); ?> or <?php is_home ?> in an if statement......eg;

<?php if(is_front_page()){ //code to add }else{ //other stuff } ?> you can also use <?php is_page($page); ?> the same way for other pages, changing the '$page' to tone you are targeting.