Skip to content

Automatically load CSS and JS files from the assets folder based on theme hierarchy and plugin activation #2

@giacomo-secchi

Description

@giacomo-secchi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions