How to add javascript in wordpress blog

Discussion in 'WordPress' started by wppluginss, May 3, 2013.

  1. #1
    I have a self hosted wordpress blog in which I want to add a javascript in the template. It is basically an ad code to monetize my blog. However, after trying alot I am not able to do so.
     
    wppluginss, May 3, 2013 IP
  2. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #2
    can you please past the code!! because it's strange !! the javascript codes work like a charm on wordpress!
     
    themes4all, May 3, 2013 IP
  3. wppluginss

    wppluginss Greenhorn

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    23
    #3
    There is no problem with the code. The problem is I do not know how to add it in wordpress templete
     
    wppluginss, May 3, 2013 IP
  4. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #4
    that depend Where you need this Ad to appear !? if you need it in Sidebar you can simple Add a Text Widget and Add the Code On It ... You can do that from your Dashboard ==> appearance ==> Widgets

    If You Need it to appear in-Post So there is a Adsense Plugins to use Otherwise Open Single.php and Add the Code where you need it to Appear !?
     
    themes4all, May 3, 2013 IP
  5. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #5
    Where do you want to display the ad? You can edit your template(s) here: WP Admin → Appearance → Editor.
     
    Devtard, May 3, 2013 IP
  6. wppluginss

    wppluginss Greenhorn

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    23
    #6
    the ad code I am trying to add is a pop up ad code. I contacted the advertiser and they said that I need to add the codes in the template. How to do that?
     
    wppluginss, May 3, 2013 IP
  7. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #7
    So go to your Dashboard==> Appearance ==> Editor

    Then open Header.php and put the code just before </head>

    Or Open Footer.php and add The code just Before </body>

    Goodluck
     
    themes4all, May 3, 2013 IP
  8. wppluginss

    wppluginss Greenhorn

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    23
    #8
    Thanks a ton buddy. You made my life easy. Placed the code where you said and it started working like a charm.
     
    wppluginss, May 6, 2013 IP
  9. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #9
    You are welcome and glad to know that it was fixed ;)
     
    themes4all, May 7, 2013 IP