【发布时间】:2015-05-23 17:29:18
【问题描述】:
由于某种原因,我的 functions.php 文件中的这段代码不适用于我的自定义 Wordpress 主题:
<?php
add_theme_support('menus');
function mySite_scripts(){
wp_enqueue_style('test', get_template_directory_uri() . '/base.css');
}
add_action('wp_enqueue_scripts','mySite_scripts');
?>
我的主题位于 wp-content/themes/mySite/css 文件夹中,名为 base.css 但是当我保存文件并运行它时,由于某种奇怪的原因没有加载样式表:(
谁能帮帮我?
PS:以防万一,我的 index.php 文件如下所示:
<!doctype html>
<html <?php language_attributes();?> >
<head>
<meta charset="utf-8" />
<title><?php echo bloginfo('title');?></title>
</?php wp_head();?>
</head>
<body>
<?php get_header();?>
<h1>My Site</h1>
<?php echo get_template_directory_uri() . '/css/base.css';?>
<?php get_footer();?>
<?php wp_footer();?>
</body>
</html>
【问题讨论】: