Home / Blogs / Research Blog / How to hide Joomla content from the hompage using a simple hack

How to hide Joomla content from the hompage using a simple hack

Ever wondered how to hide articles and/or the site title from Joomla's front page? Maybe you just want to display your content in neat little module and do away with the content component altogether.

Sure, you can manipulate the 'frontpage' menu item to remove all that, but on some templates you're still left with an ugly blank space left by the empty <div> tag.  By default, most Joomla! templates will output the content module on all pages, including the frontpage.

Here's a simple little trick to get around that.

In some cases you might want to hide the frontpage content component and use modules to display news items or blog items, but even though you haven't published any frontpage articles,  Joomla! will still print the site's title and leave a gap where the content should be.

In such cases you need to hack your template and add a little bit of code.

Go to the HTML view of your template (or the $template/html/com_content/frontpage/default.php file), and search for the following line of code:

<jdoc:include type="component" />

Enclose the above line (and the DIV tag that contains it) so it looks like this:

<?php if (JRequest::getVar('view') != 'frontpage'): ?>
<div id="xxxx">
<jdoc:include type="component" />
</div>
<?php endif ?>

Thats it! The main content component will now be hidden from Joomla's front page.


blog comments powered by Disqus
 
Share
Banner

Research Blog

What our clients say

Big Spring completely re-designed our whole website, giving us a much more functional site and were easy to work with.

Connect

Joomla Logo

Company News

Latest Projects

Contact Us

BigSpring UK Limited
29 St Austins Drive
Nottingham
NG4 3EY

Office: 0115 714 2282 (Mon-Fri 9am - 5pm)
Email: hello [at] bigspring.co.uk