How to a Have a Different Category Blog Layout for a Specific Category 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.

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:

  • Download the files blog.xml, blog.php, blog_item.php from the /components/com_content/views/category/tmpl directory.
  • Rename the downloaded files to mylayout.xml, mylayout.php, and mylayout_item.php respectively.

  • 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.

  • Make the appropriate layout modifications to mylayout.php and mylayout_item.php to accommodate the unique look & feel for that particular category.

  • Upload the renamed files to the /templates/[your template name]/html/com_content/category directory.

  • 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. However, we do recognize that if you don’t have any programming experience, then the whole thing can be very daunting, and you might be in dire need of some Joomla experts. If that’s the case, then fear not, we are always there for you. Just contact us and rest assured that we’ll do the above for you in no time and at a very affordable cost. So, what are you waiting for? Just shoot us an email or give us a call!

7 Responses to “How to a Have a Different Category Blog Layout for a Specific Category in Joomla”
  1. Comment by David — July 27, 2015 @ 4:58 am

    Thanks for this guide, it’s more clear than the one on Joomla.org.

  2. Comment by Pepperstreet — October 8, 2015 @ 10:42 pm

    Hello, just looking for some confirmation! I am aware of the 2 different override methods: Either with or without an alternative menu item XML. Both ways seem to work until one crucial point… the article’s full view! I really wonder why there is such a limitation in this great override logic and feature.

    Apparently, the only way to drill down to a proper full article Alt-Layout is to create a respective single article “Menu Item” (based on its own XML file). Why is this? In my opinion, this is a major drawback/shortcoming. It doesn’t make any sense in a real world application. For instance: I create my Alt-Layouts for “Products”, I list products wit my own Alt-Layout blog. If there are many products, then I won’t create single menu items for each and every product! I would list them with the blog and most likely with the accompanying modules in the sidebar. But every link to the full product view seems to use the default article layout.

    Did anyone else notice this behavior? I would like to hear your experiences… thanks in advance!

  3. Comment by Fadi — October 21, 2015 @ 5:23 am

    Hi “Pepperstreet”,

    You’re right about what you’re saying, but you can always create a different template, then assign that template to the category blog (in the menu item of the category blog), and when you do that, then the articles falling under this category will use the layout file in that template (and not in the master template). I know, it’s not ideal because you will end up with several templates, but this is the best workaround.

  4. Comment by pepperstreet — August 12, 2016 @ 10:33 pm

    @Fadi and Others
    As time flies by… Joomla updates come and go, but nothing seems to be changed in regards of setting and keeping “Article’s Alt-Layout”. Thanks “Fadi” for your comment and idea, but frankly speaking this is unacceptable. There must be another proper solution for this. At least new article submissions have to get the respective Alt-Layout. How to set it automatically? Any clues or ideas?

  5. Comment by Phillippe — June 17, 2021 @ 12:27 pm

    @Pepperstreet and all of the above, 2021 and I’m looking for the same answer, best one I got is from you guys here.

  6. Comment by Phillippe — June 17, 2021 @ 12:31 pm

    Also, @Fadi solution didnt work reusinge the same template style, I think maybe he was meaning a different physical folder for the template(copy) which certainly is a no-go.

  7. Comment by Serge Billon — July 22, 2022 @ 3:21 am

    Hello,

    I’m a little late but there is a solution: you have to create a menu link to the category and apply the component overload layout.

Leave a comment