History: How To Add a New Theme
Preview of version: 14
Theme components
A Tiki theme can be made of several components. as there is at least a CSS style sheet, as well as background images, fonts and, in the future, icons, and possibly one or more theme-specific Smarty templates although having customized templates is not encouraged due to potential compatibility problems.
As Tiki contains a full set of default templates, the minimum requirement to create a custom theme is a custom CSS stylesheet.
Themes are stored in the directory "themes," which is a subdirectory of the Tiki root installation directory.
Every theme has its own directory that contains the components of the theme. The name of the theme's directory is the same as the name of the theme.
The following is an example of the directory structure:
- themes
- mytheme
- css
- mytheme.css
- The .CSS file has to be named the same as the theme's directory, eg: "mytheme.css" - Tiki names the theme from the containing theme-specific folder.
- The mytheme.css is usually compiled from the less files which are in the less directory.
- custom.css
- The custom.css file contents override and complete mytheme.css. This is the place for hand-made CSS changes.
- mytheme.css
- fonts
- This is the place to store fonts to be used by the theme in cases when web fonts aren't used.
- icons
- This is the place for a specific icon font set to be used by the theme.
- images
- This is the place to store theme-related images for backgrounds and other purposes.
- js
- custom.js
- The custom.js file is the place for hand-made Javascript changes (without surrounding your code with <script> html tag).
- custom.js
- scss
- mytheme.scss
- _variables.scss
- _tiki-selectors.scss
- etc.
- This directory contains the SCSS files from which, along with global SCSS files, are compiled the theme style sheet.
- options
- Themes can have one or more options or child themes. (The themes used at this site, https://doc.tiki.org, https://dev.tiki.org and https://tiki.org are all theme options or child themes.) This is a way to provide color alternatives, for example, such as a dark mode for the website. The parent theme is loaded and then the child theme overrides any styles that it has defined.
- templates
- Any customized Smarty template stored in this directory overwrites the default template with the same name, if CSS isn't sufficient to make layout changes, for example. But having custom versions of template files is not encouraged because they can become out of date and cause errors when the site is updated to a new Tiki version.
- css
- mytheme
Activating your new theme
After you create the directories as described above for your new theme and add it to the Tiki file structure, and at least a stylesheet file with the same name as the theme's folder (such as mytheme.css) in the folder themes/mytheme/css, you will find the theme in the "Theme selection" selector in Admin -> Look & Feel -> Theme.
Please mind to reload the page after you add the theme to the server. Clearing the Tiki caches may also be necessary when you add a theme (/tiki-admin_system.php?do=all).