Friday, 11 October 2013

How To Add JavaScript To Your WordPress Posts

I think some of people know how we add the javascript code to your wordpress site by modify the theme files,we can add the jacascript code inside the post or specific pages.we can’t add the javascript code in entire site.

If you are running the self-hosted version of WordPress (not WordPress.com), you can sometimes add JavaScript through the built-in editor itself. Just change the writing mode from Visual to HTML and copy-paste your JavaScript code into the text box.

wordpress_javascript

Adding JavaScript to WordPress



The idea has been thare insert the javascript code directly to wordpress posts,Firstly you have to create the new custom field and set or fil the values of javascript code.Then insert a shortcode in your post content which will in turn fetch the value of that custom field.

Thare has been few wordpress plugin thare has been show the custom field values by the shortcodes but i use the @Gonahkar.

1.Firstly you have to add the new custom field and paste the JavaScript widget into the Value field.

2.Add the post inside wordpress firsly switch the HTML mode in your wordpress editor and insert in a new line. Save, publish and WordPress will substitute that shortcode with the actual JavaScript code. 

custom_fields

wordpress_javascript

No comments:

Masala FM

Free Shoutcast HostingRadio Stream Hosting