assets.php
Manage child theme scripts and styles.
Tags
Table of Contents
Functions
- register_scripts() : void
- Register scripts.
- register_styles() : void
- Register styles.
- enqueue_assets() : void
- Enqueue the scripts and styles.
- disable_child_theme_load() : bool
- Prevent generatepress from loading child theme stylesheet.
- get_asset_path() : string
- Return the asset path.
- get_asset_uri() : string
- Return the asset URI.
- get_asset_url() : string
- Return the asset URL (with version).
- get_asset_version() : string
- Return the version.
- get_style_tag() : string
- Create a stylesheet link tag.
Functions
register_scripts()
Register scripts.
register_scripts() : void
- The asset must start with a leading slash. It is relative to the assets directory.
Tags
register_styles()
Register styles.
register_styles() : void
- The asset must start with a leading slash. It is relative to the assets directory.
Tags
enqueue_assets()
Enqueue the scripts and styles.
enqueue_assets() : void
Tags
disable_child_theme_load()
Prevent generatepress from loading child theme stylesheet.
disable_child_theme_load() : bool
- The stylesheet will have dependencies added and enqueued late in loadng process,
Tags
Return values
boolget_asset_path()
Return the asset path.
get_asset_path(string $asset) : string
Parameters
- $asset : string
-
The target asset.
Tags
Return values
string —The fully qualified filesystem path to the asset.
get_asset_uri()
Return the asset URI.
get_asset_uri(string $asset) : string
Parameters
- $asset : string
-
The target asset.
Tags
Return values
string —The resource URI.
get_asset_url()
Return the asset URL (with version).
get_asset_url(string $asset) : string
Parameters
- $asset : string
-
The target asset.
Tags
Return values
string —The resource URL including version info.
get_asset_version()
Return the version.
get_asset_version(string $asset_path) : string
Parameters
- $asset_path : string
-
The fully qualified asset path.
Tags
Return values
string —The resource version.
get_style_tag()
Create a stylesheet link tag.
get_style_tag(string $asset) : string
- Allow direct loading of stylesheets where wp_enqueue is not used.
Parameters
- $asset : string
-
The path of the stylesheet.
Tags
Return values
string —The link tag markup.