Hey guys, I’m using a Radicle setup with Full Site Editing supporting block themes. I want to make templates, parts and patterns available globally for all block themes that are within ‘./public/content/themes’. Currently WP detects whether the active theme supports FSE with is_block_theme(), which looks for an index.html file within the relative theme directory’s template folder with get_file_path() (e.g ./public/content/themes/currenttheme/templates/index.html).
Is there a way to override this logic for WP to look within the root directory (i.e. ./templates, ./parts, ./patterns) instead? I managed to do this with symlink redirecting the folders within the active theme to the root directory but I would like to take a different approach to override the core functionality with Acorn perhaps.
Howdy! I wonder if theme_file_path or maybe another filter could be used to change those paths? Similar to what we’re doing with theme.json in the AssetsServiceProvider
I’ll try to get back to you soon with what I find out
Thanks for reaching out! The theme_file_path filter seems to only work for theme.json however for templates, patterns and parts seems like we require a different filter that changes the directory path and each of them is utilising get_stylesheet_directory() as a base path from the WP_Theme class.
Would be great if we can hook into the WP_Theme class to use app()->basePath() instead for templates, parts and patterns since themes are located privately within the public directory and would only have index.php and style.css as standard files.
I’ve actually already looked into that and it does indeed set up the root with the relevant directories however they are not accessible within FSE on the active theme (which would be located in ./public/content/themes/activetheme).
The WP_Theme class only looks for the parts, patterns and templates included within the active theme directory, it ignores the one in the root directory. We need some sort of filter to be able to override that core functionality to look within the root directory instead for those folders somehow