Applying a different theme to a custom page

Applying a different theme to a custom page

by Ryan Lowry -
Number of replies: 4

I want to apply a specific theme to some custom pages on my site. How can I force an individual page to use a particular theme?

I've noticed in the docs that there's mention of a Page Theme ("A page theme is for special page-only themes set by code.") but there is no documentation on this as far as I can see.

http://docs.moodle.org/23/en/Theme_settings#Page_theme

Can anybody point me in the right direction?

Average of ratings: -
In reply to Ryan Lowry

Re: Applying a different theme to a custom page

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Ryan,

To set a page theme you need to target the page you want to look different.

To do this you need to look at the URL for the particular page or set of pages, and take the information for your CSS selector from that URL.

For example:

Taking the URL from the address bar of my browser window as I am typing this reply, I see the following:

https://moodle.org/mod/forum/post.php?reply=998055#mformforum

From this URL I can see that the page I want to target (should I want to style it) would be #page-mod-forum-post so by adding this ID selector to my CSS stylesheet I can set style that will only target these pages.

Also using FireBug you can inspect the soursecode for your site which allows you to see the extra list of BODY tags for the page you are inspecting.

This is the list I see in this same page:

<body id="page-mod-forum-post" class="format-topics path-mod path-mod-forum gecko dir-ltr lang-en yui-skin-sam yui3-skin-sam moodle-org pagelayout-incourse course-5 context-115 cmid-46 category-1 content-only jsenabled has_dock has_dock_left_vertical dndsupported">

All the above highlighted in purple can be used as class selectors to help you home into a specific page or course or category.

Hope this helps?

Cheers

Mary

In reply to Mary Evans

Re: Applying a different theme to a custom page

by Ryan Lowry -

Hi Mary,

That's really useful, thanks for your reply! I should be able to do exactly what I want with this.

Cheers,

Ryan