Adding css and jquery files using functions.php file in wordpress?

  • 0

Using ‘wp_footer’ hook we can enqueue js files through function.php

Sample :

function en_scripts() {

wp_enqueue_script( ‘jquery’ );

wp_enqueue_script( ‘bxslider’, get_stylesheet_directory_uri().’/js/bxslider.js’, array(‘jquery’), 1.0, true );
wp_enqueue_script( ‘bxslider’, get_stylesheet_directory_uri().’/bxslider.css’, array(‘jquery’), 1.0, true );

}

add_action(‘wp_footer’,’en_scripts’);

Using ‘wp_footer’ hook we can enqueue js files through function.php Sample : function en_scripts() { wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘bxslider’, get_stylesheet_directory_uri().’/js/bxslider.js’, array(‘jquery’), 1.0, true ); wp_enqueue_script( ‘bxslider’, get_stylesheet_directory_uri().’/bxslider.css’, array(‘jquery’), 1.0, true ); } add_action(‘wp_footer’,’en_scripts’);

Using ‘wp_footer’ hook we can enqueue js files through function.php Sample : function en_scripts() { wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘bxslider’, get_stylesheet_directory_uri().’/js/bxslider.js’, array(‘jquery’), 1.0, true ); wp_enqueue_script( ‘bxslider’, get_stylesheet_directory_uri().’/bxslider.css’, array(‘jquery’), 1.0, true ); } add_action(‘wp_footer’,’en_scripts’);