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

后端 未结 2 2203
礼貌的吻别
礼貌的吻别 2021-02-11 06:18

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:28

    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');
    

提交回复
热议问题