wp_enqueue_scripts() – How to Enqueue or add scripts & ctyles in WordPress

 

 

 /** Syntax Of style and script function*/


 wp_enqueue_script( $handle:string, $src:string, $deps:array, $ver:string|boolean|null, $in_footer:boolean );


 wp_enqueue_style( $handle:string, $src:string, $deps:array, $ver:string|boolean|null, $media:string );

 function MarkOne_styles(){

     /** Fontawesome scc cdn link */
    wp_enqueue_style( 'fontawesome', 'https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
   
    /** Bootstrap scc */
    wp_enqueue_style( 'Bootstrap', get_template_directory_uri(  ) . '/css/bootstrap.min.css');

    /** Social icon css */
    wp_enqueue_style( 'Social-icon', get_template_directory_uri() . '/css/social-icon.css');

    /** Google font */
    wp_enqueue_style( 'UtilizeCSS', 'https://fonts.googleapis.com/css2?family=Ubuntu&display=swap');

    /* main css style.css file */
    wp_enqueue_style( 'MainCSS', get_stylesheet_uri(  )  );
 }
 add_action('wp_enqueue_scripts', 'MarkOne_styles');

 function MarkOne_scripts(){

    /** Bootstrap javascript */
     wp_enqueue_script( 'BootstrapJs', get_template_directory_uri(  ) . '/js/bootstrap.min.js', array('jquery'),'1.1', true);
   
    }
 add_action('wp_enqueue_scripts', 'MarkOne_scripts');




Comments