我需要在WordPress中的我的子主题中添加自定义脚本。无法在儿童主题中添加自定义js脚本
这是我的孩子主题的内容:
themes
|meteorite
|style.css
|meteorite-child
|function.php
|style.css
|js
|mngclk.js
我function.php
add_action('wp_enqueue_scripts', 'theme_enqueue_styles');
function theme_enqueue_styles()
{
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}
wp_register_script('new-script', get_stylesheet_directory_uri() . '/js/mngclk.js', 'jquery', "1", true);
wp_enqueue_script('new-script');
我试过多次变化,但我没能inclute我自定义的js脚本
风格.css是好的,我的问题是与js文件。 我已经阅读了这个链接,但没有javascript的信息 –
我认为wp_register_script函数的第三个参数,你只使用'jquery',你应该使用这个数组('jquery') –