wordpress study

Asked

Viewed 31 times

0

Someone can help me, what this command does?

wp_enqueue_style( $handle, $src = '', $deps = array, $ver = false, $media = 'all' )

I know he’s a hook , but I wanted to understand what every part of him does.

  • Complementing the answer below: The $deps is to inform dependencies. Ex.: The component ekko-lightbox depends on the Bootstrap, this will make the Wordpress load dependency first and then dependency; O $ver serve to inform the version of the file, if fill this field, the Wordpress will add the parameter ?ver=<versão> in the URL; O $media serves to inform if the CSS is for printing, canvas or both (or inform media query, ex: (orientation: landscape)).

1 answer

1


Calls a style page to the theme

First parameter ($handle): Adds a name to the stylesheet. Obs: If you need to make two file calls .css, you must add two different names, one for each sheet.

Second parameter ($src): The way of your style sheet. Obs: The URL must be absolute

Call example (add to file functions.php):

function _theme_assets() {
    wp_enqueue_style( '_theme-style', get_template_directory_uri() . '/css/style.min.css' );
}
add_action( 'wp_enqueue_scripts', '_theme_assets' );

Browser other questions tagged

You are not signed in. Login or sign up in order to post.