我在函数中使用以下代码。然而,php应用程序。在资源选项卡中检查js时,没有找到它。
它正在寻找它http://localhost:8888/goodMorningMoon/javascripts/app.js?ver=3.3.1
如何修改此代码以使其位于正确的目录中,是否需要添加get\\u template\\u directory\\u uri();在某个地方,我试过了,但没用。
提前感谢
p、 s这位于“我的功能”中。php文件,因为我从这里读到http://smashingshare.com/2010/09/22/how-to-properly-add-javascript-files-to-your-wordpress-site/ 这是包含js文件的正确方法。
<?php
function load_scripts() {
wp_enqueue_script(\'jquery\');
wp_enqueue_script(\'my_javascript_file\', \'/javascripts/app.js\', array(\'jquery\'));
}
add_action(\'init\', \'load_scripts\');
?>