• Resolved Gabriel

    (@gabriel78h)


    Whenever I try to load my javascript file from my child-theme functions.php, I get this odd error from the theme:

    <br />
    <b>Fatal error</b>:  Call to undefined function get_header() in <b>C:\xampp\htdocs\greekstone\wp-content\themes\the-bootstrap\index.php</b> on line <b>17</b><br />

    My functions.php has:

    <?php
    add_action('wp_enqueue_scripts','my_gss_scripts');
    function my_gss_scripts() {
    	wp_register_script('flyingIMG', get_template_directory_uri('flyingIMG.js', __FILE__), array('jquery'), false, true);
    	wp_enqueue_script('flyingIMG');
    }
    ?>

    Happens regardless of plugins loaded, and even if flyingIMG.js is a blank file. I’m working locally.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Loading javascript from child-theme, get_header() error?’ is closed to new replies.