質問

I am trying to link a new JavaScript file where I want to add some custom jQuery to the content. But it is not showing on my website or pages.

Here is the code in functions.php and my JavaScript file

function my_child_script(){
    wp_enqueue_script(
        'custom-child',
        get_stylesheet_directory_uri() . '/js/child-custom.js',
        array( 'jquery' ),
        '1.0.0',
        true
    );
}
add_action( 'wp_enqueue_script', 'my_child_script' );

and this is what am trying to do in my custom js file

jQuery(document).ready(function() {
    jQuery(".block-title-wrap").hide();
});
役に立ちましたか?

解決

Just replace your add action line to this one: add_action( 'wp_enqueue_scripts', 'my_child_script' ); and check again

ライセンス: CC-BY-SA帰属
所属していません wordpress.stackexchange
scroll top