WordPress.org

Ready to get started?Download WordPress

Forums

The Bootstrap
[resolved] Loading javascript from child-theme, get_header() error? (2 posts)

  1. Gabriel
    Member
    Posted 1 year ago #

    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.

  2. Gabriel
    Member
    Posted 1 year ago #

    Nevermind, figured it out

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.