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');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里