Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wp enqueue styles

/** 
 *   Enqueue your theme styles and scripts in functions.php
 *   use time() instead of a proper versioning to avoid caching when developing
 */
function my_theme_enqueue_scripts() {
    wp_enqueue_style( 'default-style', get_stylesheet_uri(), [], '1.0.0', 'all' ); //default styles.css
    wp_enqueue_style( 'main-style', get_stylesheet_directory_uri() . '/assets/css/main.min.css', [], time(), 'all' );
    wp_enqueue_script( 'main-script', get_stylesheet_directory_uri() . '/assets/js/main.min.js', [], time(), false );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_scripts' );
Comment

wp enqueue style

/** 
 *   Enqueue your theme styles and scripts in functions.php
 *   use time() instead of a proper versioning to avoid caching when developing
 */
function my_theme_enqueue_scripts() {
    wp_enqueue_style( 'default-style', get_stylesheet_uri(), [], '1.0.0', 'all' ); //default styles.css
    wp_enqueue_style( 'main-style', get_stylesheet_directory_uri() . '/assets/css/main.min.css', [], time(), 'all' );
    wp_enqueue_script( 'main-script', get_stylesheet_directory_uri() . '/assets/js/main.min.js', [], time(), false );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_scripts' );
Comment

wp_enqueue_style

wp_enqueue_style( 'my-style', get_template_directory_uri() . '/css/my-style.css', false, '1.0', 'all' ); // Inside a parent theme
wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/css/my-style.css', false, '1.0', 'all' ); // Inside a child theme
wp_enqueue_style( 'my-style', plugins_url( '/css/my-style.css', __FILE__ ), false, '1.0', 'all' ); // Inside a plugin
Comment

wp enqueue style

wp_enqueue_style( 'my-style', get_template_directory_uri() . '/css/my-style.css', false, '1.0', 'all' ); // Inside a parent theme
wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/css/my-style.css', false, '1.0', 'all' ); // Inside a child theme
wp_enqueue_style( 'my-style', plugins_url( '/css/my-style.css', __FILE__ ), false,
Comment

enqueue css wordpress

add_action( 'init', 'enqueue_css' );
function enqueue_css(){

  wp_enqueue_style( 'myStylesheet', plugins_url( 'my-css.css', __FILE__ ) );

}
Comment

PREVIOUS NEXT
Code Example
Php :: php mysql if exists 
Php :: check if url is https laravel 
Php :: how to calculate days difference between two dates in php 
Php :: how to retrieve value from stdclass array in php 
Php :: get theme path wordpress dev 
Php :: ci db query error 
Php :: string into integer php 
Php :: woocommerce get post terms product 
Php :: php capital string 
Php :: php add to associative array 
Php :: pdo last id 
Php :: custom post type 
Php :: Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in 
Php :: response()-make laravel pdf 
Php :: server error in laravel 
Php :: laravel 8 date difference in days 
Php :: laravel api too many requests 
Php :: php json_encode without square brackets 
Php :: php file for image load 
Php :: update sql php 
Php :: php slugify 
Php :: set default value for column in laravel model 
Php :: PHP Startup: Unable to load dynamic library 
Php :: php array all keys empty 
Php :: dont show file type in url 
Php :: php echo number with decimal 
Php :: sleep php 
Php :: random array php 
Php :: php var dump into string 
Php :: laravel hasmany count 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =