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

Theme Inheritance - Problem Extending Parent Theme

Started by Muut Archive 9 years ago · 4 replies · 574 views
9 years ago

I've followed the instructions to create a child theme based on X-Corporation: https://github.com/tranduyhung/grav-theme-x-corporation

With my child theme installed, I see the error ""Class 'Grav\Theme\Xcorporation' not found""

In order to verify that I'd followed the instructions correctly, I created a second theme "MyTheme" which extends Antimatter. This works without issue.

I noted that the X-Corporation theme which has a class called Xcorporation, is in a folder called "x-corporation" with an "x-corporation.php" and an "x-corporation.yaml". I've experimented with changing the folder and file names to 'Xcorporation' as to match the class name, to no avail.

What else should I try?
I'd really appreciate some help with this, otherwise I'm looking at hacking the parent theme directly or creating a new theme from scratch.

Thanks
SJS

9 years ago

what does your theme PHP file look like?

9 years ago

Apologies for the delay.
This is the version of theme PHP file when it's inheriting from Xcorporation.

Thanks
SJS

---php
<?php
namespace Grav\Theme;

class Mytheme extends Xcorporation
{
// Some new methods, properties etc.
}
?>

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1332 9 years ago
Archive · by Muut Archive, 9 years ago
2 923 9 years ago
Archive · by Muut Archive, 9 years ago
2 4052 9 years ago
Archive · by Muut Archive, 9 years ago
1 2930 9 years ago
Archive · by Muut Archive, 9 years ago
3 1109 9 years ago