CSS在wordpress网站上不起作用;调用functions.php中未定义的函数get_template_uri()
我正试图成立一家公司,并为该公司创建网站。当我查看WebsiteLive时,它都是html,没有css,但我在ehader和index.php的rel样式表中链接了它,但仍然没有css!因此,我在网上做了一些研究,并创建了一个functions.php文件,认为这就是问题所在。现在我收到了这个错误 警告:中调用的add_操作缺少参数2 /home2/elishaday/public_html/wp content/themes/smmwca/css/functions.php 第7行,并在中定义 /第405行的home2/elishaday/public_html/wp includes/plugin.php 致命错误:在中调用未定义的函数get_template_uri /home2/elishaday/public_html/wp content/themes/smmwca/functions.php on 第5行 这是我的functions.php文件 请帮忙CSS在wordpress网站上不起作用;调用functions.php中未定义的函数get_template_uri(),php,html,css,wordpress,Php,Html,Css,Wordpress,我正试图成立一家公司,并为该公司创建网站。当我查看WebsiteLive时,它都是html,没有css,但我在ehader和index.php的rel样式表中链接了它,但仍然没有css!因此,我在网上做了一些研究,并创建了一个functions.php文件,认为这就是问题所在。现在我收到了这个错误 警告:中调用的add_操作缺少参数2 /home2/elishaday/public_html/wp content/themes/smmwca/css/functions.php 第7行,并在中定义
<?php
add_theme_support( 'post-thumbnails' );
function enqueue2_my_custom_styles(){
wp_enqueue_style('animate css', get_template_uri() . '/css/styles.css', array(), '1.0.0', 'all');
}
add_action( 'wp_enqueue_scripts', 'enqueue2_my_custom_styles' );
警告显示您的functions.php位于另一个foldercss中。php必须位于主题的根目录中 另外,这是get_template_directory_uri而不是get_template_uri:
<?php
add_theme_support( 'post-thumbnails' );
function enqueue2_my_custom_styles(){
wp_enqueue_style('animate css', get_template_directory_uri() . '/css/styles.css', array(), '1.0.0', 'all');
}
add_action( 'wp_enqueue_scripts', 'enqueue2_my_custom_styles' );