WordPress子主题JavaScript文件未加载

WordPress Child Theme JavaScript File Not Loading

本文关键字:文件 加载 JavaScript WordPress      更新时间:2023-09-26

有些人可以检查以下代码并告诉我为什么自定义脚本.JS文件没有加载。自定义样式。CSS 正在加载,但脚本文件未加载。我所指的代码位于底部的函数 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');
?>

jQuery更改为jquery

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