【发布时间】:2014-04-02 19:14:31
【问题描述】:
我想在 WordPress 中包含一个用于子主题的自定义 jQuery 脚本。我在我的 WP Child Theme 文件夹/目录中的 function.php 文件中使用下面的脚本。
问题是脚本将它附加到 url 中的父主题。例如它正在输出
localhost:8888/wordpress/wp-content/themes/responsive/custom_js/footer.js
应该是什么时候
localhost:8888/wordpress/wp-content/themes/responsive-childtheme-master/custom_js/footer.js
<?
function jerrell_adds_to_the_footer(){
wp_register_script('add-footer-js', get_template_directory_uri() . '/custom_js/jquery_test.js', array('jquery'),'', true );
wp_enqueue_script('add-footer-js');
}
add_action('wp_enqueue_scripts', 'jerrell_adds_to_the_footer'); //Hooks my custom function into WP's wp_enqueue_scripts function
?>
【问题讨论】:
标签: jquery wordpress wordpress-theming