Drupal home page condition


Simply put $is_front is set only when you are on the front page of the site. The $is_front variable is not set for “listing” pages, e.g. if you click on a taxonomy term and get a listing of nodes classified under that taxonomy term.

$page is equal to 0 for all “listing” pages such as taxonomy term pages.

<?php if ($is_front): ?>
<p>This will only appear on the front page.</p>
<?php endif; ?>

<?php if ($page == 0): ?>
<p>This will appear on listing type pages.</p>
<?php endif; ?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s