inpsyde / modularity

A PSR-11 implementation for WordPress Plugins, Themes or Libraries.
https://inpsyde.github.io/modularity/
GNU General Public License v2.0
44 stars 4 forks source link

[Bug]: `ThemeProperties::basePath()` returns parent theme's path instead of child theme's #26

Closed o-samaras closed 1 year ago

o-samaras commented 1 year ago

Description of the bug

When having a child theme, ThemeProperties::basePath() returns the parent theme's path instead of the child theme's.

Reproduction instructions

  1. Create a child theme
  2. Initialize the package properties with
        $properties = ThemeProperties::new('child-theme-name');
        $package = Package::new($properties);
  3. Boot the package
  4. Use ThemeProperties::basePath()

Expected behavior

If parent theme (let's call it parent-theme) has a child theme (let's call it child-theme), then when calling ThemeProperties::basePath() from within child-theme I expect to see a path of .../wp-content/themes/child-theme. Instead I get .../wp-content/themes/parent-theme.

Environment info

Package version: 1.6.0 Browser: N/A System: Windows 10

Relevant log output

No response

Additional context

This is caused because properties are initialized using get_template_directory() instead of get_stylesheet_directory().

Code of Conduct

o-samaras commented 1 year ago

Fixed in 1.6.1.