• Hello everyone, am converting a static bootstrap template into a WP theme, a bootstrap template comes with several CSS and Javascript files, i want to know how to enque all of them at once so that i dont lose the functionality i have in a static template,please help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello
    you need to use wp_enqueue to add css and scripts to your theme in functions.php file

    see below example

    function wpdocs_theme_name_scripts() {
        wp_enqueue_style( 'style-name', get_stylesheet_uri() );
     wp_enqueue_style( 'style-name', get_template_directory_uri().'/css/my_style2.css';
        wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example1.js', array(), '1.0.0', true );
     wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/myscrtipt_2.js', array(), '1.0.0', true );
    }
    add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

    You can read complete article here

    https://developer.www.ads-software.com/reference/functions/wp_enqueue_script/

    Thread Starter amoswambugu

    (@amoswambugu)

    Thanks sajid, that was really helpful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to enque multiple CSS and Javascript files’ is closed to new replies.