简体   繁体   English

style.css 未加载到 wordpress 主题中

[英]style.css not loading in wordpress theme

Here is my code that is not working in wordpress theme.这是我在 wordpress 主题中不起作用的代码。 using this code trying to getting style.css file from wp root folder.使用此代码尝试从 wp 根文件夹获取 style.css 文件。 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但是 wp 函数文件中的这段代码工作正常

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

So can any one help me ?那么任何人都可以帮助我吗?

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

?>

add this in the functions.php file在functions.php文件中添加这个

and remember to use the : <?php wp_head(); ?>并记住使用: <?php wp_head(); ?> <?php wp_head(); ?> in the head of your html <?php wp_head(); ?>在你的 html 的头部

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM