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

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP