pfeifferNet

assets.php

Manage child theme scripts and styles.

Tags
since
5.9.0
copyright

2024 Keith Pfeiffer

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
since
5.9.0
since
6.0.0

Change asset path, uri and version handling.

register_styles()

Register styles.

register_styles() : void
  • The asset must start with a leading slash. It is relative to the assets directory.
Tags
since
5.9.0
since
6.0.0

Change asset path, uri and version handling.

enqueue_assets()

Enqueue the scripts and styles.

enqueue_assets() : void
Tags
since
5.9.0
since
6.8.0

Improve recipe detection by looking for the WPRM recipe block.

since
6.8.0

Improve conditional block assets loading.

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
since
5.9.0
Return values
bool

get_asset_path()

Return the asset path.

get_asset_path(string $asset) : string
Parameters
$asset : string

The target asset.

Tags
since
6.0.0
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
since
6.0.0
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
since
5.9.0
since
6.2.0

Simplify variables and url construction.

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
since
5.9.0
since
6.0.0

Parameter changed to require the full path.

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
since
5.9.0
Return values
string

The link tag markup.


        
On this page

Search results