문제

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