Joomla Tips – How to Make Different Category Layout in Joomla

If you’re reading this post, then this means that most likely you have reached a level, in Joomla, where you know that you can override the default layout of any view in any component by copying template files to the html directory of the template and then modifying these files. For example, if you want to override the default Category Blog layout, you will need to do the following:

  • Download, through FTP, the files blog.php, blog_item.php, and blog_links.php from the /components/com_content/views/category/tmpl directory.
  • Make some changes to your taste to the above files.
  • Upload them to the /templates/[your template name]/html/com_content/category folder (you will need to create this directory structure if it doesn’t already exist).
  • That’s it! You have now overridden the default layout for the blog layout. Joomla will now use the files in the html directory to display any page using the Category Blog menu item type.

Best and Cheap Joomla Hosting

But, what if you have a certain category that needs to have a unique, different blog layout than the others. What will you do?

Unfortunately, the above method will not work because the overridden template is applied across the board: all the Category Blog pages will have the same look and feel. Thankfully, there is another, even more powerful method, that can accomplish exactly what you want. You just need to create a new layout and then assign the menu item to that layout. In other words, you will have another menu item type (which is similar to the Category Blog menu item type)!

Here’s how to do this:

  1. Download the files blog.xml, blog.php, blog_item.php from the /components/com_content/views/category/tmpl directory.
  2. Rename the downloaded files to mylayout.xml, mylayout.php, and mylayout_item.php respectively.
  3. Open the file mylayout.xml in a text editor and 1) change the string “COM_CONTENT_CATEGORY_VIEW_BLOG_TITLE” to “My Layout”, and 2) change the string “COM_CONTENT_CATEGORY_VIEW_BLOG_OPTION” to “My Layout” as well.
  4. Make the appropriate layout modifications to mylayout.php and mylayout_item.php to accommodate the unique look & feel for that particular category.
  5. Upload the renamed files to the /templates/[your template name]/html/com_content/category directory.
  6. Now create a menu item of type My Layout and you should see that the layout that you have just created is applied!

Wonderful, huh? And the best thing is that you haven’t made a single code change to Joomla’s core (or any Joomla file for that matter – core or non-core), which means that your newly created layout will not be overwritten/removed by a future Joomla update!

Now, at first glance, the above process might seem a bit complicated, but it’s not – it’s really straightforward. It takes just a tiny bit of time if you follow the instructions.