Allow theme change by URL: Difference between revisions

From MoodleDocs
Line 4: Line 4:
Enabling this setting in Moodle 2.0+ themes allows you to change theme by adding either '''?theme='''  or '''&theme=''' (followed by the theme name you wish to change to) depending on where you are at the time you want to swap to another theme.  
Enabling this setting in Moodle 2.0+ themes allows you to change theme by adding either '''?theme='''  or '''&theme=''' (followed by the theme name you wish to change to) depending on where you are at the time you want to swap to another theme.  


The name of theme you put in the url parameter is the shortname of the theme. You can find this by going to ''Site administration > Plugins > Plugins overview'' page to the ''Themes'' section. The shortname of a theme is below the theme name: take the part after the underscore. For example for theme_boost use the shortname '''boost'''. For theme_classic use '''classic''', and so forth. (This shortname is the same as the module name.)
The name of theme you put in the url parameter is the shortname of the theme. You can find this by going to ''Site administration > Plugins > Plugins overview'' page to the ''Themes'' section. The shortname of a theme is below the theme name: take the part after the underscore. For example for theme_boost use the shortname '''boost'''. For theme_classic use '''classic''', and so forth. (This shortname is the same as the module name.)  
 


===Usage===


'''For Example:'''
'''For Example:'''
If you are at the front page of your site that add '''?theme='''
If you are at the front page of your site then add '''?theme='''
<pre>http://localhost/moodle30/?theme=essential</pre>
<pre>http://localhost/moodle30/?theme=essential</pre>
after clicking the Enter tab on your keyboard. this will change from your present theme to the Essential theme layout, providing or course that you have that theme installed in your Moodle site.
after clicking the Enter tab on your keyboard. this will change from your present theme to the Essential theme layout, providing or course that you have that theme installed in your Moodle site.
Line 17: Line 17:
will change theme to Essential after clicking the Enter tab on your keyboard.
will change theme to Essential after clicking the Enter tab on your keyboard.


Notes:
===Notes===
* The session level theme will persist until the user logs out and their session ends.  
* The session level theme will persist until the user logs out and their session ends.  
* When the user logs out, they will then see the Default site theme once again, not the Session theme.  
* When the user logs out, they will then see the Default site theme once again, not the Session theme.  

Revision as of 18:57, 4 August 2021

Site Administration > Appearance > Themes > Theme settings

Enabling this setting in Moodle 2.0+ themes allows you to change theme by adding either ?theme= or &theme= (followed by the theme name you wish to change to) depending on where you are at the time you want to swap to another theme.

The name of theme you put in the url parameter is the shortname of the theme. You can find this by going to Site administration > Plugins > Plugins overview page to the Themes section. The shortname of a theme is below the theme name: take the part after the underscore. For example for theme_boost use the shortname boost. For theme_classic use classic, and so forth. (This shortname is the same as the module name.)

Usage

For Example: If you are at the front page of your site then add ?theme=

http://localhost/moodle30/?theme=essential

after clicking the Enter tab on your keyboard. this will change from your present theme to the Essential theme layout, providing or course that you have that theme installed in your Moodle site.

Alternatively if you are in a course page then add &theme=

http://localhost/moodle30/course/view.php?id=3&theme=essential

will change theme to Essential after clicking the Enter tab on your keyboard.

Notes

  • The session level theme will persist until the user logs out and their session ends.
  • When the user logs out, they will then see the Default site theme once again, not the Session theme.
  • The hierarchy of theme contexts applies to session level themes so sometimes it may not appear to work if a course or category has a theme set, since it takes precedence over the Session theme.