This PR improves the default WordPress template hierarchy, because the custom templates didn't work.
Explanation
By default, WordPress searches for templates in the theme root. Our blade templates are located in resources/views and WordPress couldn't find them automatically.
To solve this issue we can use a small trick. The root of the template is resolved based on the placement of the style.css file. So to keep the default searching algorithms, we just need to move the style.css, screenshot.png, functions.php to the resources directory and activate the theme again. After this, WordPress will search for the custom templates there.
We also need to adjust the FM\Templates\Resolver::relocate function a little bit to track the paths correctly.
This PR improves the default WordPress template hierarchy, because the custom templates didn't work.
Explanation
resources/views
and WordPress couldn't find them automatically.style.css
file. So to keep the default searching algorithms, we just need to move thestyle.css
,screenshot.png
,functions.php
to theresources
directory and activate the theme again. After this, WordPress will search for the custom templates there.FM\Templates\Resolver::relocate
function a little bit to track the paths correctly.MORE INFORMATION
Relocation FIX
The
FM\Templates\Resolver::relocate
function simply takes the default WordPress templates paths relative to the theme root:and changes to the correct paths to our blade files:
This way, we fix the problem with custom templates. Previously the custom templates paths were resolved incorrectly.