Styles Handler
The styles handler exposes the following public methods:
register_public_style
for adding a style to the internal frontend registration queuederegister_public_style
for removing a style from the internal frontend registration queueenqueue_public_style
for adding a style to the internal frontend enqueueing queuedequeue_public_style
for removing a style from the internal frontend enqueueing queueregister_admin_style
for adding a style to the internal admin-side registration queuederegister_admin_style
for removing a style from the internal admin-side registration queueenqueue_admin_style
for adding a style to the internal admin-side enqueueing queuedequeue_admin_style
for removing a style from the internal admin-side enqueueing queueadd_inline_style
for registering a CSS string to be outputted before or after another enqueued file
The methods follow almost 1-to-1 the WP scripts API, in particular the wp_register_style
function, the wp_enqueue_style
function, and the wp_add_inline_style
function.
The register_admin_style
and enqueue_admin_style
methods accept a specialized argument $hook_suffixes
. By default it's null
, but it can be set to an array to conditionally register/enqueue the scripts only when the global variable $hook_suffix
is set to one of the values.
As mentioned on the Assets Service page, the handler will automatically attempt to register/enqueue the minified version of your script (if it exists in the same folder and has the .min.css
extension) and will attempt to set the file version to the result of the PHP filemtime
function.
For assets being loaded from an external URL, the $fallback_version
argument will be used by default instead of trying to call filmemtime
on the script.
Last updated