How To Add Javascript To WordPress


#Ipage support will drive you mad! – Have moved to #Ipage because of their pricing, but boy am I frustrated! I have domains which apparently have been hosted by them decades ago and their (faulty) system apparent keep any domain name active in their system for ever! They demanded that I would provide proof of ownership by providing the last 4 digits of the creditcard(!) used when they had it registered!!! After countless tickets/emails they finally agreed to check based on the whois name that I own it and thereafter finally they transferred the domain! absolutely brainless at that support desk and typical for, yip I am saying it: Indian support! Abubakar Sattar, Pakistan, www.mywebhostingreview.info/


In this video I will show you how you can add you own Javascript file to WordPress. I love Javascript!!

wp_enqueue_script code reference:

add_action()

Javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript

jQuery: https://jquery.com/

If you have questions please leave a comment below.

Twitter: https://twitter.com/ieatwebsites
Linkedin: https://www.linkedin.com/in/joseluisfremaint
instagram: https://www.instagram.com/ieatwebs/
Facebook: https://www.facebook.com/Ieatwebsites/

Music by PeriTune – Coffee Lounge
https://soundcloud.com/sei_peridot

iEatWebsites

32 Comments
  • Daniel Campos
    Posted at 18:33h, 17 February

    wooow that is awesome

  • Marc Moeller
    Posted at 01:01h, 25 February

    sweet mate

  • Zuc Zuc
    Posted at 18:54h, 03 March

    good job!!

  • Invsisible
    Posted at 04:24h, 19 March

    Realy good job.
    Can you say me how i can add a java banner in my contribution?!

    Thanks for help

  • Michael Nielsen
    Posted at 13:40h, 23 March

    How did you get your WordPress files in a script editor?

  • Abdo Abo
    Posted at 23:40h, 27 May

    thanks a lot bro ur great man merci gracias chokran

  • SpacingCake
    Posted at 13:30h, 30 May

    heey but what happen when you update the theme? than every thing is gone right?

  • Feroz Bhagoe
    Posted at 08:08h, 13 June

    Hey, it worked! 😀 Thanks for your supertutorial!

  • madushan senevirathna
    Posted at 10:34h, 13 June

    How to call jQuery library to functions.php

  • SnakeKoRn
    Posted at 14:59h, 24 June

    Tysm man!

  • ilyabitru
    Posted at 18:49h, 27 June

    Thank you!!!!

  • Giorgio Vitanza
    Posted at 14:13h, 08 July

    Hi! I followed your tutorial but when I refreshed the page it became blank, I'm sure the syntax is correct, any idea?

  • mickomoo
    Posted at 08:03h, 30 July

    My jquery is properly enqueued, but when I use class tags in my html they're unaffected by the jquery function.

  • Daniel Bachmann
    Posted at 16:55h, 19 August

    Really well done! Thank you.

  • Bucur Ion Niculae
    Posted at 03:26h, 25 August

    Cool stuff.

  • TECNOPLAYTV
    Posted at 14:57h, 11 September

    posta o código para download por favor

  • Ahaiziah Shako
    Posted at 16:10h, 14 September

    hi my fadetoggle does not work. i works partially. the class hides for less than a sec then shows

  • Ahaiziah Shako
    Posted at 03:17h, 24 September

    could somebody help!! it fades for less than a second then it shows again. it does not completely come off

  • Life got Creative
    Posted at 23:49h, 09 October

    Hi, the following SCRIPT is BLOCKED when I check google console. Do you know how htt​p:/​/pa​gea​d2.​goo​gle​syn​dic​ati​on.​com​/pa​gea​d/j​s/a​dsb​ygo​ogl​e.j​s error can be fixed please?

  • Santosh Kumar
    Posted at 15:25h, 18 October

    loved it

  • Christian Georgie Adou-Boni
    Posted at 09:27h, 24 October

    Thanks for this tutorial !

  • Ammar Aiman
    Posted at 16:27h, 10 December

    Enjoy your tuts… woowwwww….thanks

  • Hezi Tenenboim
    Posted at 19:31h, 09 January

    Basic question: if I know how to JavaScript, why do I need the basic WP theme at all? Wouldn't it make more sense for me to code the website from scratch? This is something I'm not getting…

  • sancho
    Posted at 11:11h, 16 February

    Thank you J!!!!! I'm a newbie and was up until 3 trying to figure my crap website and your solution solved my problem!!

  • Wilfred Bancairen
    Posted at 05:23h, 02 March

    Thanks!

  • José M Montoro
    Posted at 02:18h, 29 March

    That’s awesome, thanks!

  • teemoIRL
    Posted at 06:44h, 02 April

    a basic problem i had was when i used the get_stylesheet_directory_uri, it came up with an abort and said it was trying to go through the themes style.css file instead of going straight into the JS folder, if you have this problem use get_template_directory_uri instead, probably a better idea to beguin with, not sure why ude use a style directory for a js file

  • sharifa bahar
    Posted at 05:02h, 17 April

    It works well for me. Your video saved my life in the company. Thank you so much for the excellent explanation.

  • 정호섭
    Posted at 12:36h, 07 May

    how should I do if I want to add js to just specific one page? I think your code will add javascript file to all my wordpress pages but I want to add my javascript file just on a specific wordpress page

  • Ademola Alabi
    Posted at 10:11h, 10 September

    Thank you for your help, this has assisted me greatly.

  • Eniel Garcia
    Posted at 21:36h, 13 September

    Hi, nice tutorial, I am kind of new in this, I did everything you said but nothing happen. Silly question: do I have to add any jQuery file to my wordpress?

  • David Susen
    Posted at 18:37h, 19 September

    thank you just what I needed !! 🙂