[英]Style.css and Bootstrap CDN not loading in Function.php
[英]Style.css and Bootstrap CDN not loading in Function.php
<?php
function load_css(){
wp_enqueue_style('load_css', get_theme_file_uri('/style.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( 'parent-style', get_template_directory_uri() . '/style.css' );
// wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
}
add_action('wp_enqueue_scripts', 'load_css');
?>
在 style.css 中,我给了 body { color: orange; 它没有向我显示 index.php 中的橙色标题,这意味着 style.css 未正确加载。 我想为页脚加载 boostrap.js 文件,并且 style.css 必须正常工作。 有人可以帮我解决错误吗?
<?php
function load_css(){
wp_enqueue_style('load_css', get_theme_file_uri('/style.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( 'parent-style', get_template_directory_uri() . '/style.css' );
// wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
}
add_action('wp_enqueue_scripts', 'load_css');
?>
在 style.css 中,我给了 body { color: orange; 它没有向我显示 index.php 中的橙色标题,这意味着 style.css 未正确加载。 我想为页脚加载 boostrap.js 文件,并且 style.css 必须正常工作。 有人可以帮我解决错误吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.