display/hide content only on the front page
Task · front page · modify front page · Themers · Drupal 4.5.x or older · Drupal 4.6.x · Drupal 4.7.x · Drupal 5.x · Needs Updating
Last modified: August 18, 2009 - 06:10
description
This snippet allows you to hide/display content on the front pageof a Drupal site.
usage
- Using a text editor like notepad.exe, kate, TextWrangler or an equivalent, copy and paste the snippet into your page.tpl.php or your custom page-type.tpl.php file.
- Remove the exclamation point (!) to show on the front page and use it to show everywhere except the front page.
- Change the div class names or the link prefix text to suit.
The following example snippet will insert an image called blocks-top.jpg on all pages EXCEPT the front page.
<?php if (!$is_front): ?>
<div id="snapshot">
<img src="http://www.example.com/images/blocks-top.jpg" /><br />
</div>
<?php endif; ?> 