A safe way to add/enqueue a CSS style file to the wordpress generated page. If it was first registered with wp_register_style() it can now be added using its handle.

* Enqueue scripts and styles
function srh_enqueue_scripts() {
wp_enqueue_style( ‘font’, get_stylesheet_directory_uri() . ‘/style-fonts.css’, array(), ‘1.0.0’, true );
wp_enqueue_script( ‘script-name’, get_stylesheet_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true );

add_action( ‘wp_enqueue_scripts’, ‘srh_enqueue_scripts’ );



(string) (required) Name used as a handle for the stylesheet. As a special case, if the string contains a '?' character, the preceding part of the string refers to the registered handle, and the succeeding part is appended to the URL as a query string.

Default: None
(string|boolean) (optional) URL to the stylesheet. Example: 'http://example.com/css/mystyle.css'. This parameter is only required when WordPress does not already know about this style. You should never hardcode URLs to local styles, use plugins_url (for Plugins) and get_template_directory_uri (for Themes) to get a proper URL. Remote assets can be specified with a protocol-agnostic URL, i.e. '//otherdomain.com/css/theirstyle.css'.

Default: false
(array) (optional) Array of handles of any stylesheet that this stylesheet depends on; stylesheets that must be loaded before this stylesheet. false if there are no dependencies.

Default: array()
(string|boolean) (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: false
(string|boolean) (optional) String specifying the media for which this stylesheet has been defined. Examples: 'all', 'screen', 'handheld', 'print'. See this list for the full range of valid CSS-media-types.

Default: 'all'

Return Values

This function does not return a value.