【问题标题】:Working on custom wordpress theme and having trouble with next: wp_enqueue_scripts使用自定义 wordpress 主题并遇到下一个问题:wp_enqueue_scripts
【发布时间】:2017-06-25 20:57:20
【问题描述】:

我正在尝试将自己的主题添加到 wp 主题中。但我收到下一个错误:
http://something.comget_template_drectory_uri/css/non.css?ver=1.0.0 网络::ERR_NAME_NOT_RESOLVED

我的文档路径有问题吗?

接下来是functions.php的路径: /home/something/something.com/wp-content/themes/something/functions.php

在我要入队的文件旁边: /home/something/something.com/wp-content/themes/something/css/nono.css

<?php

    function nono_scrypt_enqueue (){

    wp_enqueue_style('customstyle',get_template_drectory_uri.'/css/nono.css',array(),'1.0.0', 'all' );
    wp_enqueue_script('customjs',get_template_drectory_uri.'/js/createO.js',array(),'1.0.0', 'all' );    
    }

    add_action( 'wp_enqueue_scripts', 'nono_scrypt_enqueue' );

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    那里有一个错字(directory),而且get_template_directory_uri() 是一个函数,所以只有带括号才能工作。 将get_template_drectory_uri 更改为get_template_directory_uri(),它应该可以工作。

    【讨论】:

    • 我在添加括号后得到了这个:致命错误:在 /home/something/something.com/wp-content/themes/something/functions.php 中调用未定义的函数 get_template_drectory_uri() 5
    • 谢谢你的括号。我也忘记了 d"i"rectory 中的 "i"。
    猜你喜欢
    • 1970-01-01
    • 2021-08-29
    • 2018-09-23
    • 2021-08-24
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多