Multiple themes on a site

Have a noob question here. Is it possible to use multiple themes on one site? For example I lets say that I have a site using the Future2021 theme and I want to create 1 or 2 pages that will use a different theme all together. Is this possible at all?

If not… Can I create multiple sites (each will have their own theme) but that I can manage from 1 Admin site. I know I can create sub-folders for each of the sites

webroot
    - foo
    - bar
    - foobar

So the idea is to have 1 admin at the webroot level that can control the other 3 sites. Hope any of this makes sense to anyone. TIA for any help!

Yes, it can be done.
when creating page from admin panel, it asks which template we want to use for that page. It is mostly default one. but lets say you have Future2021 as your theme and want your /testpage1 to use quark theme, so you just need to copy and paste what you need from quark theme and create a different template than “default”, lets name it as “befault”. so when you create /testpage1 you just need to select befault template and it will be done :slight_smile:
If your next question will be “how can i do that?”
there is 2 possibilities:

  1. learn grav more from Basics | Grav Documentation
  2. find someone to do that for you

I tried to copy the template from the other Theme to the templates folder, but it was not showing at all. I am sure that it is not as a simple copy and paste.

yes, it needs to be configured.
it starts from “default” to “befault”

@prborg,

I am sure that it is not as a simple copy and paste.

You are right… A theme is much more than a single page template copied between themes.

  • Every template included by the alternate theme’s page template (eg. base, navigation, sidebar, macros, etc.) must be copied and renamed.
  • Because of the templates renames, most templates need to be editing to include the correct renamed templates.
  • Javascripts might need to be copied
  • css most definitely needs to be copied
  • fonts might need to be copied
  • A theme might need initializations setup by PHP in its <theme>.php file.
  • etc.

This is a very impractical strategy.

Alternatives:

  • Grav can host multiple sites using a single installation. Multiple sites can use different subdomains or subfolders. Eg. https://mydomain/subfoldertheme1/home and https://mydomain/subfolderotheme2/somepage.
    Each site is independent and can use its own themes, pages, plugins ets.
    Not sure how Admin will transparently handle this.
  • There is a plugin called Themer that allows to swap theme on a page by page basis. The plugin is old, very old, and its code is outdated, but might still work. Basically its sets variable pages: theme: <theme> in user/config/system.yaml at runtime and resets $this->grav['theme'] and $this->grav['twig'] to use the new theme.

Disclaimer, I usually test all my suggestions, but haven’t tested any of the above.

1 Like

they have different admins
like example.com/admin and example.com/a-different-page/admin
still for example plugins can be shared.
this opinion is not bad and i use it a lot but i didnt suggest it for this case because it is too powerful for just theming. it is like creating a new website. still as you said it is another strategy so i may be wrong at skipping it.