[英]style.css not loading in wordpress theme
这是我在 wordpress 主题中不起作用的代码。 使用此代码尝试从 wp 根文件夹获取 style.css 文件。 这段代码的问题是任何不正确的东西,比如函数名
<?php
function add_style() { wp_enqueue_style('style', get_stylesheet_uri()); }
add_action('wp_enqueue_scripts','add_style');
?>
但是 wp 函数文件中的这段代码工作正常
register_nav_menus(array(
'primary' => __('Primary Menu')
)) ;
那么任何人都可以帮助我吗?
<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">
将此添加到您的 header.php
function custom_scripts_method() {
/* CSS */
wp_enqueue_style( 'boostrap-style', get_template_directory_uri().'path to file from theme folder' );
}
add_action( 'wp_enqueue_scripts', 'custom_scripts_method' );
?>
在functions.php文件中添加这个
并记住使用: <?php wp_head(); ?>
<?php wp_head(); ?>
在你的 html 的头部
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.