在 Function.php 中未加载 Style.css 和 Bootstrap CDN [英] Style.css and Bootstrap CDN not loading in Function.php
本文介绍了在 Function.php 中未加载 Style.css 和 Bootstrap CDN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
function load_css(){
wp_enqueue_style('bootstrap-cdn-css', 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css');
wp_enqueue_script('bootstrap-cdn-js', 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js', 'jquery', false, true);
wp_enqueue_style('my_style', get_stylesheet_directory_uri().'/style.css');
}
add_action('wp_enqueue_scripts', 'load_css');
在 style.css 中,我给了 body { color: orange;它没有向我显示 index.php 中的橙色标题,这意味着 style.css 未正确加载.我想为页脚加载 boostrap.js 文件,并且 style.css 必须正常工作.有人能帮我解决这个错误吗?
In style.css, I have given body { color: orange; } it is not showing me orange color for heading in index.php, it means style.css not loaded correctly. and I want to load boostrap.js file for footer and style.css must work correctly. Could somebody help me to solve the error?
推荐答案
错误的文件名 function.php
.它是 Functions.php
.问题解决了.:)
Wrong file name function.php
. It is Functions.php
. Problem solved. :)
这篇关于在 Function.php 中未加载 Style.css 和 Bootstrap CDN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文