For all Joomla 3+ templates built using the Zen Grid Framework v4 (any theme after October 2014) please refer to the Zen Grid Framework v4 documentation.
There are times where you may only want to display some of the elements of your website on the front page and hide it on all others - this tutorial will help you walk through creating frontpage conditionals for Zen Grid Framework compatible templates.
There are a few ways to do this within Joomla itself but this trick involves two lines of code and is set at the template level which avoids any complication for your users changing a setting in the website admin.
Depending on the template you are using you may need to create a template override. If the template already has an override in place for the element you want to hide then you can skip this part of the process.
In this tutorial we are going to create an override and frontpage conditional to show the tagline of the site only on the front page.
The logo override file will automatically be referenced now rather than including the core framework logo.php file.
1. Open the template/[your template]/layout/logo.php file and locate the following code:
{codecitation}
<?php ($enableTagline) { ?>
<div id="tagline">
<span style="margin-left:;margin-top:;">
<?php echo $tagline ?>
</span>
</div>
<?php } ?>
{/codecitation}
2. Now simply change this to the following:
{codecitation}
<?php if (Yth::isHome() && $enableTagline) { ?>
<div id="tagline">
<span style="margin-left:;margin-top:;">
<?php echo $tagline ?>
</span>
</div>
<?php } ?>
{/codecitation}
or if you wanted to hide the tagline from the front page you would change the code to this:
{codecitation}
<div id="tagline">
<span style="margin-left:;margin-top:;">
</span>
</div>
<?php } ?>
{/codecitation}
The Zen Grid Framework uses the Yireo Template helper to do some of its core functionality and so creating the front page conditional is as simple as adding the YTH::isHome reference and the helper does the rest.
You can extend this theory to make any number of changes and conditions for elements to display or not be displayed on the frontpage depending on your needs.