Add CSS Per Page With Joomla – Page Class Suffix Not Working
I think with the template I have installed for Joomla that the Page Class Suffix is broken for some reason so I cannot easily add CSS changes that way. I was amazed at how hard it was for me to locate how to do this. I searched forever on Google and could not find the correct answer as most people discussed using Page Class Suffix which again was not an option for me. Anyhow when it came down to it I took the following steps to do this and was really surprised at how easy it was.
In Extensions >> Template Manager you can assign pages to different templates with Joomla. So the easiest solution for me was to copy my current template over to a new directory as described below.
- Copy Joomla Template: cp -Rp templates/current-template templates/new-template
- Make Any Changes:vi templates/new-template/css/template.css (Modify any CSS parameters you would like to be different)
- Navigate Joomla Admin: Open up the Joomla admin, Go to Extensions >> Template Manager; Click the radial button next to the new template; Click Edit;
- Associate New Template To Page/Pages: Under Menu Assignment click the radial button next to Select From List; Highlight the pages you want to use this new template;
- Your Done: Save the new template; Check your pages!
Thats it! You could have a different template for each page if you wanted to. In my case I only wanted to front page to be different.
So if you just want a different template on your frontpage for instance then follow the directions above and in 5 minutes it can be using a new template. This was way easier than I was expecting it to be! Joomla has yet to let me down.
This method would allow you to assign different CSS stylesheets to each page within Joomla if you wanted to. I would suggest against doing this for more than one or two pages though as your users will catch themselves downloading endless copies of the same files if you have a different Joomla template for each page.
If you want to become a Joomla ninja check out the book below.