How to load bootstrap script and style in functions.php (wordpress)?

后端 未结 2 571
無奈伤痛
無奈伤痛 2021-02-11 06:00

I converted bootstrap theme to wordpress. Now, I have a problem in loading the bootstrap scripts and style. This is my code in functions.php

   function wpbootst         


        
2条回答
  •  孤城傲影
    2021-02-11 06:36

    you cas use "wp_enqueue_style" and "wp_enqueue_script".

    for example:

    function reg_scripts() {
        wp_enqueue_style( 'bootstrapstyle', get_template_directory_uri() . '/css/bootstrap.min.css' );
        wp_enqueue_style( 'bootstrapthemestyle', get_template_directory_uri() . '/css/bootstrap-theme.min.css' );
        wp_enqueue_script( 'bootstrap-script', get_template_directory_uri() . '/js/bootstrap.min.js', array(), true );
    }
    add_action('wp_enqueue_scripts', 'reg_scripts');
    

提交回复
热议问题