dongyulan6251 2015-03-11 04:04
浏览 76
已采纳

wordpress function.php无法加载css样式表

I've tried for hours to make wp_enqueue_style running when load in head part.

this is my code

function test_script(){

//Add Bootstrap Style
wp_enqueue_style('muarif-bootstrap',get_template_directory_uri().'/inc/css/bootstrap.css');

}
add_action('wp_enqueue_scripts','test_script');

But when i running my website, it's not load properly.

Here is my generated head

<head>
     <title>Muarif Gustiar | Web Developer - User Experience - Digital Marketing</title>
     <meta charset="UTF-8">
     <meta name="description" content="">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     <style type="text/css"></style>
</head>

What wrong with my code? i follow the instruction to enqueue here. Any suggestion?

  • 写回答

1条回答 默认 最新

  • douduiti3040 2015-03-11 04:21
    关注

    Give this ago

    function test_script(){
    
    wp_register_style("bootstrapcss", get_template_directory_uri() . "/inc/css/bootstrap.css");
    
    wp_enqueue_style('bootstrapcss'); 
    
    }
    
    add_action('wp_enqueue_scripts','test_script');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!