The ThemeKey module allows you to use themes other than the default theme on your site in particular contexts. This can include using a different theme for certain paths, or allowing certain users to select a different theme.
Using a different theme for certain paths can be useful if you need to give a particular set of pages a different look and feel-- for instance, if you create a small set of basic page nodes with information about a conference co-sponsored by your project, and you want the conference to have its own branding and design, but don’t want to create and maintain a completely separate website for it. Letting users with an admin or similar role choose a different theme can be useful if you don’t have a separate “development” version of your site, and you want someone on the project staff to work on designing a new theme without it interfering with the operation of the live site. In such a situation, the person can configure ThemeKey so that only they can see the new theme as it’s being developed, while all other visitors see the old version of the theme. When the new theme is ready, it can be made the default theme.
Install the ThemeKey module. Enable ThemeKey and the ThemeKey UI sub-module. If you want to allow certain users to pick a different theme, also enable the ThemeKey User Profile module.
Go to Configuration > User Interface > ThemeKey > Settings > User interface. At the top of this screen, toggle down the option for “Selectable themes”, and check the box for each theme you want to be selectable through ThemeKey. Only enabled themes will be available in this list; see section 18.4.2 for how to enable themes.
Further down, under “UI settings”, you can check the box for “Add theme option to user profile” to allow users to switch themes; this option is only available if you have enabled the ThemeKey User Profile module. The “Show theme option in the 'URL aliases' administration” option is a way to assign a theme based on a particular path; check this box as well and save the changes.
Go to People > Permissions and if you have the Module Filter module enabled, use the “Filter list” box at the top to enter “ThemeKey”; if this box is not available, scroll down the page until you find the ThemeKey section. Adjust the permission settings to define which role(s) should be able to choose a different theme via their user profile (via “Select different theme” under “ThemeKey User Profile”), and which role(s) should be able to assign path alias themes (via “Assign path alias themes” under “ThemeKey UI”. By default, only users with the “administrator” role can do this, which may be sufficient for your site. Save the changes.
If a user has permission to choose a different theme from their user profile, they can accomplish this by editing their user profile (for instance, by clicking on their username in the upper right of the administration bar, if they have access to it, and then choosing “edit” from the tabs above their user profile). They can toggle open a section called “Theme configuration”, and choose any theme that was enabled on the ThemeKey configuration page. When they save the changes, the site theme will change, but only for that user.
Figure 18.5 Theme configuration options embedded in the profile of a user who has permission to select another theme. The theme selected by the user will only appear for that user, and will not affect anyone else’s experience of the site.
To change the theme for a specific page, go to Configuration > Search and metadata > URL aliases. Find a page where you want to use a different theme, and click the “edit” link on the right. Toggle down “theme configuration” at the top, and choose one of the themes enabled on the ThemeKey configuration page. Repeat for any other page(s) that you want to display with a different theme.
Figure 18.6 To change the theme for the person profile for Adah Belle Thoms, toggle open “Theme Configuration” and select the theme. If you do not see this setting, make sure you have checked the box for “Show theme option in the 'URL aliases' administration” under Configuration > User Interface > ThemeKey > Settings > User interface.
If you have multiple pages that have a similar path (e.g. conference-name/schedule, conference-name/keynote-speakers, conference-name/travel), rather than setting the theme for each one of the URL aliases, you can use the ThemeKey theme switching rule chain to configure the theme once for all relevant pages. To access this configuration page, go to Configuration > User Interface > ThemeKey. Create a new rule, and under “Theme switching rule chain”, select path:node_alias. The operator should be = (the default). In the following box, if you wanted to change the theme for the conference-name paths listed above, you would enter: conference-name/%; for this module, the % acts as a wildcard, like the * when specifying paths in the block configuration screen. Then, under “Theme”, select the theme that should be used, and save the configuration.