Search Marketing Consultant

Web Marketing & Search Engine Consultant

How to use javascript in your WordPress posts

How to use javascript in your wordpress posts

This is my first post on WordPress – I think I owe it some information to the community and here is a tip on how to include javascript in your WordPress posts.

Why include javascript in a post ? Well I found the need when I began to use the WordPress-notable plugin – The best place to call for action is at the end of your post; if your reader is satisfied by yoru post and finds the right tools within reach of mouse, there’s a chance you’ll get bookmarked.

This is the place to make all your bells and whistles available to your users.

Obviously notable doesn’t carry all possible social bookmarking sites, and you might wish to propose some that are particularly effective with your readers.

Many sites offer HTML code or a javascript – provides a neat feature called the network badges.

delicious network badge screenshot

This is my network badge.

You get this badge with a javascript code that looks like this:

<script type=”text/javascript” src=” name;nwcount;fancount;icon” / >

After implmenting this code at the end of my posts I noticed funny things were happening like all posts after the first were missing off the home page.

The problem was identified in a conflict from within the browser, confused by the javascript string and truncating all content from there onwards. So I tried modifying the the javascript to:

<script type=”text/javascript” src=” name;nwcount;fancount;icon”> </script>

but the WYSIWYG Plugin for WordPress was removing the </script> …

SOLUTION: modify javascript to:

<script type=”text/javascript” src=” name;nwcount;fancount;icon” ><!– –></script>

introduce a comment and it works !

You can further progress your knowledge on javascript in wordpress at the Codex WordPress website.

Server and software problem solving provided by Raimondo.