简体   繁体   English

正在处理自定义的wordpress主题,然后遇到麻烦:wp_enqueue_scripts

[英]Working on custom wordpress theme and having trouble with next: wp_enqueue_scripts

I am trying to add my own theme to wp themes. 我正在尝试将自己的主题添加到wp主题中。 But I am getting next error: 但是我收到下一个错误:
http://something.comget_template_drectory_uri/css/non.css?ver=1.0.0 net::ERR_NAME_NOT_RESOLVED http://something.comget_template_drectory_uri/css/non.css?ver = 1.0.0 net :: ERR_NAME_NOT_RESOLVED

Is it something wrong with path to my documents? 我的文档路径有问题吗?

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

and next to file which I want to enqueue: /home/something/something.com/wp-content/themes/something/css/nono.css 并在要排队的文件旁边:/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' );

there is a typo in there (d i rectory) and also get_template_directory_uri() is a function, so it will only work if you bring the brackets. 书中有一个错字(d 教区长),也get_template_directory_uri()的函数,因此,如果你把括号它只会工作。 Change get_template_drectory_uri to get_template_directory_uri() and it should work. 更改get_template_drectory_uriget_template_directory_uri()它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM