Joomla Check If Front Page

This tutorial I will show you how to check if the user is viewing the front page of your Joomla website. This can be very useful in your theme or extension where you need to perform different actions.

Step 1
Get our current application

$app = JFactory::getApplication();

Step 2
Next we get the Joomla menu object

$menu = $app->getMenu();

Step 3
Finally we get the active menu and check if it is the default which would be the front page.

if ($menu->getActive() == $menu->getDefault()) {
	echo 'This is the front page';

That’s it. Leave a comment and follow us on Twitter @westernstudios

Please Post Your Comments & Reviews

Welcome to Western Studios

We provide professional website and mobile softwares including Joomla, Wordpress and more.