问题
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