I moved to Now I am blogging there, so please visit and keep me reading. love, Debiprasad

Ask questions related to online shopping in India

Where to buy online in India?

JavaScript sidebar widget plugin for WordPress : uses source

This is a very simple sidebar widget which places JavaScript code in the widget. In this plugin, you need to provide the url of the JavaScript and this plugin will use that js file as it's source.

Download the plugin here

I will go through all the JavaScript codes we use generally in our websites or blogs and will update compatibility list here.


  • BidVertiser Ads
    BidVertiser Ads codes provide an URL of JavaScript code, which you need to include as the source in a JavaScript block. Get the url from the code generated from BidVertiser and provide while editing the widget values and you can see the ads in this sidebar widget.

Snapshots will be provided soon

If you want to put any JavaScript code inside the <script> tag, then try my JavaScript Block Widget plugin (Download).

You can also able to add JavaScript codes in text widget in sidebar. So you don't need this plugin.

JavaScript sidebar widget plugin for WordPress : uses sourceSocialTwist Tell-a-Friend TwitThis Reading: JavaScript sidebar widget plugin for WordPress : uses sourcePost Link to Twitter


Liber said...

hi i tried to install it but after i add the widget to my sidebar i'am trying to edit and i get :

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in home/user/public_html/wp-content/plugins/javascript-block-widget/jsBlock.php on line 63

and :

Warning: Invalid argument supplied for foreach() in /home/user/public_html/wp-content/plugins/javascript-block-widget/jsBlock.php on line 81

Debiprasad said...

Hi Liber,
Thanks for trying this.

Could you tell me please which php version and WordPress version are you using?

You can also choose the built in text widget of WordPress to add any javascript to your blog.

Personal Transformation Radio said...

I'm also getting the Warning: array_merge error message when trying to use your widget in my WordPress blog. I'm using Word Press version 2.7.1 and php version 1.

My text widget doesn't display my java either.

You have 2 java widgets, which is the better one to use for putting java as well as html in the sidebar?

Debiprasad said...

Hi, Thanks for trying this.

When I created these two plugins, I was unaware that, you can use the built in text widget of WordPress to add any arbitrary text, html and javascript too. But this javascript not accepted on blogs hosted at . This confusion tempted me to create these two plugins.

As you said java, this widget is not for java, it's for javascript. Please confirm me, what are you using, java or javascript. I hope it's javascript, not java.

As you said your text widget doesn't display your java (probably javascript) either. I am surprised that it's not working on WP 2.7.1 version. I tried it and found it's working fine. If you like you can try this: <script>alert('ss');</script>
If this alerts "ss", then your text widget is able to accept javascript.

There are two javascript plugins. Using this one you can use the javascript, which uses an external file as a source. Other one for javascripts declared on the page. You don't need to provide script tag while using, just need to give the code withing, Example: alert('ss');

You said you using PHP version 1, it's quite impossible. Please verify that again. However I accept array_merge() as an issue and try to fix this. Will let you know when I able to fix this.

Thanks again.

Personal Transformation Radio said...

Yes, I was talking about javascript, not java.

You say that the WordPress text widget will accept javascript or html. In the text box area, do I need to include the html and /html tags around the content?

Your includeJS.php file starts with the following text. That's why I thought your version was version 1. Thanks, I look forward to your thoughts on all of this.



* Include JavaScript widget


* Allows you to insert any javascript code from a js file to your Wordpress widget


* @author Debiprasad Sahoo

* @version 1

* @copyright Debiprasad Sahoo

* @since 21 March 2009



Skyey said...

See the awesome plugin i found !. Its name is HTML-Javascript-Adder
It enables to add Javascripts, HTML, and other scripts in the sidebar without editing the sidebar.php file. It is a widget.

Debiprasad said...

@Personal Transformation Radio

In that text box area, you don't need to add <html> or </html> tag. Only other markups are needed, example: <b>, <div>, <p> etc. If you want to put javascript in that, add <script> tags and keep your javascript code in between that. Example: <script>alert('ss');</script>

Well that's the version of this plugin. I asked your php version.

Debiprasad said...

The only advantage of HTML-Javascript Adder as compared to built-in text widget is WYSIWYG editor.

Al said...

I received the same errors listed above when I installed the plug-in.

The problem is that as of PHP5 the array_merge() function only accepts parameters that are arrays. The function:


used as the second parameter; returns Boolean FALSE when no options have been previously saved.

To fix you can set the function result to a variable and then check the variable to see if the array_merge is necessary.

Or you could use type casting in the array_merge function call to cast the result of the function as an array.

I am not familiar with the inner workings of WordPress or your plug-in so I am not sure which option is more appropriate.

My Shared Items in Google Reader

My Blogroll


Want to see/show anything here? Contact me :)