putting javascript and css in your WP posts

WP does NOT allow you to use javascript or css stylesheets; you need to rely on templates for the functionality you need. I imagine it is too easy for someone’s reply to do nasty things to your web page if you allow unrestricted javascript and css.

As a workaround, you might think of using iframes and adding style attributes to a tag.

So you go to ‘Add New Post’, then pick the ‘HTML’ tab. In this post I added an iframe between 2 thick horizontal lines, which follow right here:


http://olive.heroku.com/demo/olive


When you click the ‘Visual’ tab you get a large box representing the iframe and where iframe’s contents will be, and the horizontal lines are thick. To see this you will have to eidt this page yourself.

But in Preview mode, or after publishing the page, the iframe has been converted to a link, and the horizontal rules are the default ones.

So WP uses a standard Visual+HTML editor and only does its filtering of your content when you go to publish or preview the page.

Advertisements

More Information

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s