Issue: Automatically load CSS and JS files from the assets folder based on theme hierarchy and plugin activation
Description:
All CSS and JS files located in the assets folder must be automatically loaded for both parent and child themes. The logic should handle the following cases: plugin-specific assets, RTL styles, and ensure proper handling based on theme hierarchy.
Requirements:
[ ] Automatic Loading of Assets:
All CSS and JS files located in the assets folder must be automatically loaded without manual inclusion.
[ ] Plugin-Specific Assets:
If files are inside the assets/plugins/ folder, they should be loaded only if the corresponding plugin is active.
Check if the plugin is active using its folder and file name (e.g., assets/plugins/plugin-name/).
[ ] CSS RTL Logic:
If the site is RTL (is_rtl()), automatically load only CSS files ending in -rtl.css.
If the site is not RTL, automatically load standard CSS files (excluding -rtl.css).
[ ] Parent and Child Theme Hierarchy:
For Parent Themes: Automatically load assets using filename.asset.php when available.
For Child Themes: Prefer asset.php for loading. If asset.php is not available, automatically fallback to loading filename.css directly.
Expected Outcome:
All CSS and JS files located in the assets folder are automatically loaded according to the specified logic, with correct RTL or straight versions, plugin activation, and respect to theme hierarchy.
if "plugin A" is enabled load the file (evaluate if is better to make check using is_plugin_active function or class_exists( 'woocommerce' ) ) here is a code example that will be replicated: if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) && is_singular() )
I will try to add isPage: ['about-us', 'cart'] option on theme.json to verify if it is an easy way for conditionals implementation
An exlude option culd be added, for example "exclude": is_page('about_us')
Issue: Automatically load CSS and JS files from the
assets
folder based on theme hierarchy and plugin activationDescription:
All CSS and JS files located in the
assets
folder must be automatically loaded for both parent and child themes. The logic should handle the following cases: plugin-specific assets, RTL styles, and ensure proper handling based on theme hierarchy.Requirements:
[ ] Automatic Loading of Assets:
assets
folder must be automatically loaded without manual inclusion.[ ] Plugin-Specific Assets:
assets/plugins/
folder, they should be loaded only if the corresponding plugin is active.assets/plugins/plugin-name/
).[ ] CSS RTL Logic:
is_rtl()
), automatically load only CSS files ending in-rtl.css
.-rtl.css
).[ ] Parent and Child Theme Hierarchy:
filename.asset.php
when available.asset.php
for loading. Ifasset.php
is not available, automatically fallback to loadingfilename.css
directly.Expected Outcome:
assets
folder are automatically loaded according to the specified logic, with correct RTL or straight versions, plugin activation, and respect to theme hierarchy.