注册样式表然后将其加入队列与直接将其加入队列有何不同?我在这里注册然后入队。 function calling_script(){ wp_register_style('bootstrap', get_template_uri(). `enter code here`'/css/bootstrap.min.css',array(),'1.0.0', 'all'); wp_enqueue_style('bootstrap'); wp_register_style('style', get_template_uri(). '/css/style.css',array(),'1.0.0', 'all'); wp_enqueue_style('style');}add_action('wp_enqueue_style','calling_script');这里我直接入队:function calling_resources(){ //Calling Styles wp_enqueue_style('style',get_stylesheet_uri(),'','1.0.0'); wp_enqueue_style('comment_style',get_template_directory_uri().'/css/comments.css','','1.0.0'); wp_enqueue_style('404 style',get_template_directory_uri().'/css/style-404.css','','1.0.0');}add_action('wp_enqueue_scripts','calling_resources');两者的工作方式相同。但我看到许多专家在这两种不同的方式中做。
1 回答
肥皂起泡泡
TA贡献1829条经验 获得超6个赞
wp_register_style :-
这意味着,如果您想注册您的脚本,但不直接将它们加载到您的页面中,您可以注册一次文件,然后在需要时加载它们。
wp_enque_style :- 它可以帮助您加载脚本
- 1 回答
- 0 关注
- 176 浏览
添加回答
举报
0/150
提交
取消