Having trouble with enqueue java script files

  • Unknown's avatar

    I am trying to do my first external javascript file. I read the codex on the enqueue and think I followed it correctly but it does not seem to be working. This is what I have in my functions.php file. Any insight would be helpful. THANKS!

    add_action( ‘admin_enqueue_scripts’, ‘wpb_adding_scripts’ );

    function wpb_adding_scripts($hook) {
    if( ‘index.php’ != $hook ) {
    // Only applies to dashboard panel
    return;
    }
    wp_enqueue_script(‘my-first-script1’, plugins_url(‘/js/my-first-script.js’, __FILE__), array(‘jquery’),’1.1′, false);
    }

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    What is the site URL in reference? Outside of the Business Plan, we do not allow certain tags on WordPress.com, for security reasons, including JavaScript, Flash, iframe, form, and input tags .

    Based off of what you are describing, and it appears you’re in the wrong forum. Your site is using the open source WordPress.org software and you need to seek help at these forums:

    https://wordpress.org/support/forums/

    These forums are for WordPress.com hosted sites only. If you want to know more about the differences between WordPress.com and WordPress.org you can read this document:

    WordPress.com vs. WordPress.org

    Thanks!

  • Unknown's avatar

    Hi Darnell,
    Thanks for the reply. Right now I am just working offline with the wordpress software and Xampp. I do have a site with Bluehost which is using WordPress.

    I am not sure I understand your reply. I am creating a custom WordPress theme. I currently have my jscript in the header file and everything works fine. I am just trying to clean up the code a little bit and move some of the jscript over to individual js files. I thought I could do that based on some of the WordPress site information that I read. However, when I move my jscript code over to unique js file and try to enqueue it, it isn’t working like it was before. That is my question.

    The URL for my official site is as below but the code I am currently running is just in staging and isn’t live yet.
    http://university-grades.com/

    Any help is appreciated.
    Thanks.
    Jeff

  • That is a self-hosted WordPress.org site, which we really can’t help with here.

    To clear up any confusion, WordPress.com and WordPress.org are two different entities: http://support.wordpress.com/com-vs-org/

    WordPress.org has complete documentation for self-hosted/installed versions of WordPress.org at https://wordpress.org/support/ and support at https://wordpress.org/support/forums/

  • The topic ‘Having trouble with enqueue java script files’ is closed to new replies.