WordPress儿童主题JavaScript文件未加载

时间:2015-01-11 21:02:46

标签: javascript jquery wordpress

可以请检查以下代码,并告诉我为什么CUSTOM-SCRIPT.JS文件没有加载。 CUSTOM-STYLES.CSS正在加载,但脚本文件不是。我所指的代码位于底部的FUNCTION CUSTOM_STYLES()但我认为上面的代码必须很重要。

    <?php

function bean_feature_setup()
{
    $args = array(
        'primary' => array(
            'adminstyles'       => true, 

            'customizer'        => true, 
            'meta'              => true,
            'seo'               => true,        
            'widgets'           => true, 
            'widgetareas'       => true, 
            'whitelabel'        => false,
            'updates'           => false,
            ),
        'plugins' => array(
            'notice'            => true,
            'portfolio'         => true,
            'shortcodes'        => true,
            'twitter'           => true,
            'instagram'         => true,
            'social'            => true,
            'pricingtables'     => true,
          ),   
        'comments' => array(
            'pages'             => false,
            'portfolio'         => false,
            'posts'             => true,
            ),
        'debug' => array(
            'footer'            => false,
            'queries'           => false,
            ),   
        );
    return apply_filters( 'bean_theme_config_args', $args );
}
add_action('bean_init', 'bean_feature_setup');

?>

    <?php
function custom_styles() {

    wp_enqueue_style('custom_style', get_stylesheet_directory_uri().'/custom-styles.css', array(),'', false);
    wp_enqueue_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jQuery'),'', false);

}
add_action('wp_enqueue_scripts','custom_styles');

?>

1 个答案:

答案 0 :(得分:0)

jQuery更改为jquery

 wp_enqueue_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jquery'),'', false);