Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Themes FAQ.
- 1 How do I install a new theme?
- 2 How can I restrict the available themes to users and in courses?
- 3 How do I create a custom theme?
- 4 Can I assign a specific theme to a course?
- 5 How can I get the links in my custom menu to open in new windows?
- 6 Where shall I put my custom CSS code?
- 7 Will I lose my courses, language files, logo, etc. if I switch my theme?
- 8 I can't access theme files on the server. Can I still add a logo to a theme?
- 9 Are there tools which help me creating and editing themes?
- 10 How do I check for cross-browser compatibility?
- 11 How are the device types used in Moodle 2.2 ?
- 12 Concrete examples for modifying Moodle themes
- 13 How can I see theme changes when using the Windows Complete Installer package
- 14 See also
How do I install a new theme?
- Unzip the .zip file to an empty local directory.
- Upload folder to your web server to the /moodle/theme/[Theme Name]. (Replace [Theme Name] with the name of the theme you have downloaded.) Ensure the new theme folder and its contents are readable by the webserver. Change Read and Write permissions (CHMOD) for the files and folder to 755 - Owner read/write/execute, Group read/execute, Everyone read/execute. Incorrect permissions may prevent display of the newly installed theme.
- Choose your new theme from within Moodle via Administration > Appearance > Themes > Theme selector.
How do I install a new theme when using cPanel?
- Upload your new theme .zip file to your web server via cPanel.
- Then using cPanel install the new theme to your Moodle theme's folder. The new theme will be installed into its own folder at /moodle/theme/[mytheme] (where [mytheme] is the name of your new theme.
- Ensure the new theme folder and its contents are readable by the webserver. If necessary change Read and Write permissions (CHMOD) for the files and folder to 755 - Owner read/write/execute, Group read/execute, Everyone read/execute. Incorrect permissions may prevent display of the newly installed theme.
- Choose your new theme from within Moodle via Administration > Appearance > Themes > Theme selector
Why is the new theme I uploaded not showing up in Theme Selector?
You probably forgot to do something correctly. Here are steps to create a "new" theme from an existing theme called "standard". Bold show places you must change for the theme to appear.
- Copy folder theme/standard and call it theme/new
- In theme/new/lang/en folder,
- Renamed theme_standard.php to theme_new.php
- Opened theme/new/lang/en/new.php, recommend you change 2 lines to read something like:
- $string['pluginname'] = 'New theme - Martin D';
- $string['choosereadme'] = 'New theme came from the Standard theme and is being changed by Martin D in 2011';
- Saved the file
- In theme/new/config.php
- Change $THEME->name = 'new';
- In theme/new/version.php
- Change $plugin->component = 'theme_new';
- Went to Settings > Site Administration >Appearance > Theme settings > Theme designer mode (Checked)
- Settings > Site Administration >Appearance > Theme selector
- Clear theme caches
- Select theme
- Tip: There could be a number of problems with the theme you uploaded, but one major problem reported in the Themes Forum all point to the way in which the theme is uploaded on certain servers. Using the cPanel method, as described in the FAQ How do I install a new theme when using cPanel? will, in most cases, cure the problem.
How can I restrict the available themes to users and in courses?
- In Settings>Site Administration>Appearance>Themes>Theme settings, add the themes you want them to use in the Theme list.
How do I create a custom theme?
See the developer documentation Theme development.
Can I assign a specific theme to a course?
Yes. In the course settings, use the "Force theme" dropdown box.
It is possible to create your own fly out menu via the custom menu block in Settings>Site administration>Appearance>Themes>Theme settings. Copy the examples given below the box. If you want the links to open in a new window, use the following code:
Where shall I put my custom CSS code?
Note that the standard themes Afterburner, Arialist, Formal White, Fusion, Nonzero, Overlay, Sky High and Splash all offer the possibility to add custom CSS in their page settings via Settings>Appearance>Themes>.
Failing this, instead of modifying the theme's CSS files you better put your own code in a separate CSS file and make your theme aware of that file by modifying its config.php file (be sure add your own CSS file as the last one in the list so that you will override all prior settings). See this posting for detailed instructions.
See also the instructions on creating your own theme mentioned above.
Will I lose my courses, language files, logo, etc. if I switch my theme?
Switching themes only changes the appearance of your site, not the content within it. The logo is a part of the theme and will be lost when you switch.
Follow these instructions to add a logo to a theme.
- If you upgrade your Moodle site and tweaked an existing standard theme, you will lose your changes. Thus it is a good idea to create a custom theme which will not be changed when you upgrade.
I can't access theme files on the server. Can I still add a logo to a theme?
Yes. You have two choices:
- Either upload your logo to another place publicly available online and then copy the image's URL to paste into the logo field of the theme page you are editing (such as Afterburner)
- Or add the main menu block to your front page; upload the logo via Main menu>Add a resource. Get its URL and paste it into the logo field of the theme page you are editing. You can safely then hide or delete the main menu block; the logo will still be there. (NOTE - your logo will appear in Navigation>Site pages as well.)
Are there tools which help me creating and editing themes?
Clear Cache Button
This useful Firefox add-on let's you add a button to your tool bar for easily clearing your cache while working on your theme: https://addons.mozilla.org/de/firefox/addon/1801
Please note that the following tools are only for development. They only change the way you see your Moodle site, not the Moodle site itself. Any changes you make using these tools will not be visible to anyone else who uses your site. For this you will have to make those changes permanent by changing your theme's CSS files for example.
You can enhance Firebug even further. See Firebug for more information.
Web Developer Toolbar
Another great tool for any web developer is the Web developer extension, another Firefox add-on. One very useful feature is the option to disable your browser's cache while working on your theme. That way you are sure you're always presented with your latest modifications and not with an older, cached version.
Now also available for Google's Chrome browser: "The Web Developer Toolbar Comes to Chrome"
Modifications made with Firebug are lost when refreshing your page. If you want your CSS changes to be a bit more permanent, for example to try them with different pages of your Moodle installation, you can use another Firefox plugin: Stylish. That way you can change your site's CSS with a simple mouse click without having to change Moodle code.
See Stylish for detailed instructions and examples.
This is an custom additions to the Stylish extension which brings back features from 0.5.9 and adds new features.
How do I check for cross-browser compatibility?
There are some tools (standalone and online) which can show you how your site looks in different browsers. See this forum discussion for details. See the new device detection settings in Theme settings which will allow you to create a theme for those "special" browsers.
How are the device types used in Moodle 2.2 ?
If "Enabled device detection" has been turned on, Moodle 2.2 will automatically use the theme which has been set for the device in the Theme selector settings page. It is also possible to add additional types to the Theme selector page by using the "device detection regular expressions" fields.
Site administrators can find these enable device detection settings in Site administration > Appearance >Themes > Theme settings .
Concrete examples for modifying Moodle themes
The following examples were taken from the former Theme Scrapbook:
"The Moodle Theme Scrapbook is a collection of small how-to descriptions. You theme designers and Moodle users working with themes add your knowledge here to help new Moodle users with tips and tricks for their theme work.
Feel free to add to this list! Don't know how? Read our Guidelines for contributors."
- dev:Forcing the colour of the chat discussion pane (pop-up mode)
- Changing background colour of a topic box
- How to change the colour of the popup event's header and background
Logo and icons
- Using an alternate icon set in Moodle
- Change the favicon that shows in front of the web address
- Replace the logo in the footer with your web address and/or or own logo
- Replace the logo in the header
- Overriding the $menu / $button variables using PHP regular expressions in header.html
- Changing the view of course categories - work in progress
- Sub categories and courses layout - work in progress
- Tracker 'components' list too small
- Hiding an element with CSS is generally achieved using the display: none; property on the element.
- See dev:Print style and dev:Stylish#Print style for Database records for an example how to hide parts of a page not meant for printing.
- Centre smaller forum posts on the page
- Positioning the page footer
- Left align quiz questions and answers
- Indentation for nested categories
- Positioning login and choose language field
- Match question type - position answers nearer to the questions
- dev:Stylish#Fixed admin menue with CSS
- Creating a fixed-width theme
- Is there a way to fix oversized HTML Editor using CSS?
- Modifying the design of specific categories with CSS
How can I see theme changes when using the Windows Complete Installer package
In the Windows Complete Installer package, the eAccelerator in the XAMPP install can cause some issues with changes to your theme's CSS and HTML files from showing.
Open the php.ini file inside of the server\php folder from your install in notepad and search for "eAccelerator" you should see a line that reads:
Insert a semi-colon (turns the line into a comment) at the start of this line so it now reads:
Restart the Moodle server using the "stop moodle" and then the "start moodle" programs in your server folder. You should now find that all of your changes to your CSS are reflected as soon as you save the file and refresh your browser cache (usually you can refresh your cache by pressing F5). This FAQ from a discussion at Deactivating caching with XAMPP installations