bbp_enqueue_style( string $handle = '', string|bool $file = '', array $deps = array(), string|bool $ver = false, string $media = 'all' )
Enqueue a script from the highest priority location in the template stack.
Description Description
Registers the style if file provided (does NOT overwrite) and enqueues.
Parameters Parameters
- $handle
-
(Optional) Name of the stylesheet.
Default value: ''
- $file
-
(Optional) Relative path to stylesheet. Example: '/css/mystyle.css'.
Default value: ''
- $deps
-
(Optional) An array of registered style handles this stylesheet depends on.
Default value: array()
- $ver
-
(Optional) String specifying the stylesheet version number, if it has one. This parameter is used to ensure that the correct version is sent to the client regardless of caching, and so should be included if a version number is available and makes sense for the stylesheet.
Default value: false
- $media
-
(Optional) The media for which this stylesheet has been defined. Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print', 'screen', 'tty', or 'tv'.
Default value: 'all'
Return Return
(mixed) The style filename if one is located. False if not.
Source Source
File: includes/core/template-functions.php
function bbp_enqueue_style( $handle = '', $file = '', $deps = array(), $ver = false, $media = 'all' ) { // Attempt to locate an enqueueable $located = bbp_locate_enqueueable( $file ); // Enqueue if located if ( ! empty( $located ) ) { // Make sure there is always a version if ( empty( $ver ) ) { $ver = bbp_get_version(); } // Make path to file relative to site URL $located = bbp_urlize_enqueueable( $located ); // Register the style wp_register_style( $handle, $located, $deps, $ver, $media ); // Enqueue the style wp_enqueue_style( $handle ); } return $located; }
Changelog Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |