style.css未加载到wordpress主题中


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(); ?>在html 的头部