style.css not loading in wordpress theme

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 10:25:09

问题


Here is my code that is not working in wordpress theme. using this code trying to getting style.css file from wp root folder. what's problem in this code is any thing not correct like function name

<?php
function add_style() { wp_enqueue_style('style', get_stylesheet_uri()); }
add_action('wp_enqueue_scripts','add_style');
?>

But this code in wp function file is working correctly

register_nav_menus(array(
    'primary' => __('Primary Menu')
    )) ;

So can any one help me ?


回答1:


<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">

add this to your header.php




回答2:


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' );

?>

add this in the functions.php file

and remember to use the : <?php wp_head(); ?> in the head of your html



来源:https://stackoverflow.com/questions/36680866/style-css-not-loading-in-wordpress-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!