Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Chosing inherited theme in admin panel

first-time theme

Started by nwi 5 years ago · 10 replies · 741 views
5 years ago

Hi, I have created a child theme to Quark following the manual guide. But how do I swap to the new theme? It is not displayed in the admin / themes page. Or are child themes not displayed there?

5 years ago

@nwi, If properly defined a child theme shows up in Admin.

I would suggest to use the easier and less error prone CLI version:

BASH
$ bin/gpm install devtools
$ bin/plugin devtools new-theme
  // Choose inheritance when asked for theme type
last edited 10/26/21 by pamtbaau
5 years ago

For me the manual way is easier as I don't really understand the CLI way to do it.

5 years ago

Thank you for your advise, pamtbaau.
For me the manual way is easier as I don't really understand the CLI way to do it.

This is what I did:

  1. Created the folder user/themes/mgb-theme
  2. Copied the YAML file an added the code as described.
  3. Copied the blueprints.yaml
  4. Changed the config/system.yaml.
  5. Created a new theme Class file.

Screenshot 2021-10-26 151717|690x216

Is there anything obviously wrong? Thanks for any tipps.

5 years ago

@nwi, Have you tried the CLI method to see if that creates a functional child theme?

5 years ago

No, that is much more complicated for me, as I have not installed PHP on my PC to run CLI.

5 years ago

Hi @nwi
 

In your "mgb-theme.php" file try

PHP
<?php
namespace Grav\Theme;

use Grav\Common\Theme;

class MgbTheme extends Quark
{
    // Access plugin events in this class
}

Note:

  • NEW ADD : use Grav\Common\Theme;
  • Lowercase letter to uppercase : class Mgbtheme to class MgbTheme

 
The sub-theme must be visible in the backoff > theme 🙂

 
Sincerely
Kit

5 years ago

@nwi:
I have not installed PHP on my PC to run CLI

Wait, are you developing on production?

5 years ago

Thanks for the suggestion @Kit , but it did not work. 🤔
It is probably something very obvious, but I'm new to Grav and I have no idea, what could be wrong.

5 years ago

Yes, but that shouldn't be the cause.

5 years ago

@nwi what's in your blueprints.yaml file ?
mbg-theme > blueprints.yaml

<details>
<summary>My blueprints.yaml</summary>

TXT
name: Mbg Theme
slug: mbg-theme
type: theme
version: 0.1.0
description: xxx
icon: rebel
author:
  name: xxx
  email: [email protected]
homepage: https://github.com/xxx/grav-theme-mbg-theme
demo: http://demo.yoursite.com
keywords: grav, theme, etc
bugs: https://github.com/xxx/grav-theme-mbg-theme/issues
readme: https://github.com/xxx/grav-theme-mbg-theme/blob/develop/README.md
license: MIT
dependencies:
  - { name: grav, version: '>=1.6.0' }

</details>

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 198 2 months ago
Themes & Styling · by Ian, 2 months ago
3 94 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 455 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 48 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 128 3 months ago