• Resolved JudahsMom63

    (@judahsmom63)


    I added this code to my child functons.php:

    ‘// enqueue jquery
    function load_jquery() {
    wp_enqueue_script( ‘jquery’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘load_jquery’ );

    // add custom javascript file
    function load_scripts(){
    wp_register_script(‘topline’, get_stylesheet_directory_uri() . ‘/script/topline.js’, array(‘jquery’), false);
    wp_enqueue_script(‘topline’);
    }
    add_action(‘wp_enqueue_scripts’, ‘load_scripts’);’

    In my child header.php I added this:

    ‘<script type=’text/javascript’ src=”<?php echo get_stylesheet_directory_uri(); ?>/script/topline.js”></script>’

    I have cleared my cache and deactivated all of my plugins. The only result was more reference errors. I managed to get WP to find my topline.js file in my child theme folder. I did not do <script>etc.jQuery</script> in my child header.php because I thought jQuery came with WP. Please tell me what I am doing wrong. Thank you. P.S. Sorry the post is so long.

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter JudahsMom63

    (@judahsmom63)

    @andrew – I tried to create a subdomain but I got an error establishing a database connection. I know that my host uploaded my database, and I know that my FTP uploaded my files, so I don’t know what to do now except wait to see if something’s wrong on their end. Thanks again for your help. I’m going to close this thread now.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You can always open a new thread to discuss this

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘jQuery is not defined error’ is closed to new replies.