pfeifferNet

assets.php

Register styles and scripts. Enqueue child theme sytylesheet.

  • This method of handling of asset path and uri is the pattern to use going forward.
  • The child theme stylesheet (style.css) is re-enqueued to ensure it is loaded after the parent theme styles, and thus can override them.
  • The asset must NOT start with a leading slash. It is relative to the assets directory.
Tags
since
0.0.0

Table of Contents

Functions

register_styles()  : void
Register styles.
enqueue_assets()  : void
Enqueue the scripts and styles.
requeue_child_assets()  : void
Dequeue and enqueue the child theme styles.
get_asset_path()  : string
Return the asset filepath.
get_asset_uri()  : string
Return the asset URI.
get_asset_version()  : string
Return the version.

Functions

register_styles()

Register styles.

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

Improve style dependencies.

since
2.0.0

Improve asset handling and versioning.

enqueue_assets()

Enqueue the scripts and styles.

enqueue_assets() : void
Tags
since
0.0.0

requeue_child_assets()

Dequeue and enqueue the child theme styles.

requeue_child_assets() : void
  • This is necessary to ensure the child theme stylesheet is enqueued after the parent theme styles, and thus can override them.
Tags
since
2.0.0

get_asset_path()

Return the asset filepath.

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

The target asset - no leading slash.

Tags
since
0.2.0
since
2.0.0

Improve asset handling and versioning.

Return values
string

The resource filesystem path.

get_asset_uri()

Return the asset URI.

get_asset_uri(string $asset) : string
Parameters
$asset : string

The target asset - no leading slash.

Tags
since
0.2.0
since
2.0.0

Improve asset handling and versioning.

Return values
string

The resource URL.

get_asset_version()

Return the version.

get_asset_version(string $asset) : string
Parameters
$asset : string

The fully qualified server file path of the target asset.

Tags
since
0.0.0
Return values
string

The resource version.


        
On this page

Search results