How to add a scrip in a blog page??

Discussion in 'Programming' started by mrb1129, May 27, 2014.

  1. #1
    I want to add a javascript in my wordpress blog site, as a new page. I have got the code, just tell me how to add it. It is an url opener script.
     
    mrb1129, May 27, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Create a new page, paste the code in the page? Or create a new template page, use the code there (paste it into the tamplate page file) and use the template page as the basis for the new WP-page?
     
    PoPSiCLe, May 28, 2014 IP
  3. tovidebne

    tovidebne Active Member

    Messages:
    251
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    All you need is here (http://codex.wordpress.org/Using_Javascript)
    Remark: JavaScript cannot be added to post content without a special WordPress Plugin that removes the filters that prevent unwanted code within the post content area, for the protection of the user.
     
    Last edited: May 29, 2014
    tovidebne, May 29, 2014 IP
  4. Jigney

    Jigney Active Member

    Messages:
    168
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    93
    #4
    If you want to use javascript on all the pages, then you can make a .js file and then include it in the footer of the theme.

    Or if you don't want to include javascript in all the pages than you can create a template, you will get it here (http://codex.wordpress.org/Page_Templates#Creating_a_Page_Template)

    And then write your JS code in it and select that template for the Page in which you want to include javascript.
     
    Jigney, Jun 4, 2014 IP