https://github.com/jenstornell/theme-loader
Why use themes?
Why use a theme you might wonder? Kirby does not work like that, or does it?
I’m planning to use the same setup for a new site in the future. Design, layout and some functions should be the same, but the content, blueprints and controllers should be different.
To have the common parts of the project as a theme and the unique parts in the “normal” folders I get the best of both worlds. I can copy the theme easy and only lift over the common things.
I’m using my theme loader on a site and it works really well. Good job with the register set guys!
Kirby Theme loader
Load and switch themes from /site/themes/
.
Install
Add the folder theme-loader
in site/plugins/
.
Usage
- Add a folder called
themes
insite
. - Add a folder with your theme name like
my-theme
tothemes
. - Add a filename that matches the theme name like
my-theme.php
. - Add a
c::get('plugin.theme.loader.name', 'my-theme')
to activate the theme.
To sum up, the theme filepath would be like /site/themes/my-theme/my-theme.php
Making the theme
To make use of the theme loader you need to set stuff with the registry feature:
https://getkirby.com/docs/developer-guide/plugins/registry
Options
Name (required)
To activate a theme you need to add an option for it.
c::get('plugin.theme.loader.name', 'my-theme')
Root
If you don’t want to load the theme from site/themes
you can change it.
c::get('plugin.theme.loader.root', kirby()->roots()->site() . DS . 'themes')
Requirements
Kirby 2.3
License
MIT
@Thiousi You make themes right? What do you think?