doufangpian5545 2019-04-15 04:27
浏览 127

CSS无法在wordpress网站上工作; 在functions.php中调用未定义的函数get_template_uri()

I am trying to start a company and am creating website for that company. When I look at website live it is all html and no css but i have it linked in rel stylesheet in the ehader and index.php but still no css! So i did some research online and created a functions.php file figuring that that was the issue. Now I am recieving this error

Warning: Missing argument 2 for add_action(), called in /home2/elishaday/public_html/wp-content/themes/smmwca/css/functions.php on line 7 and defined in /home2/elishaday/public_html/wp-includes/plugin.php on line 405

Fatal error: Call to undefined function get_template_uri() in /home2/elishaday/public_html/wp-content/themes/smmwca/functions.php on line 5

This is my functions.php file!

please help

<?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' );
  • 写回答

1条回答 默认 最新

  • dtpwra8456 2019-04-15 05:13
    关注

    The warning shows that your functions.php located in another folder(css). the functions.php must be located into the theme's root directory.

    Also, That's get_template_directory_uri() not 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' );
    
    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗