in WordPress/Blogging

Widget Plugin – How to add the additional text-widgets for your sidebar?

The Text-widget is the most useful widget in Widget plugin. It allows you to place the HTML code or Javascript on your sidebar. In my blog, I have used a lot of text-widgets for showing links, feed count, adsense, license, stats and so on. As you were like me, you may probably need more text-widgets for your sidebar. Unfortunately, there are only 9 text-widgets available in your widget by default. How do we do to get the additional text-widgets more than 9?

The answer is simple. You need to make a few minor changes in the code of widget plugin. Don’t worry if you are not programmer. It is very simple and everybody can do it… I will show the steps how to change and what to change the source code of widget plugin. Actually, there are only 3 lines to change so you just follow all those steps carefully and get it done.. :) Don’t forget to backup your code.

Note: Widget.php is located under wp-includes if you are using Wordpess 2.3. (Why not in plugins folder? Because the widget plugin is natively supported by wordpress started from version 2.3. ) To edit this file, you have to download this file to your local machine and have to upload it back after editing. You can’t use the plugin editor to edit this file.

Steps to follow ~

  1. Download widget.php file to your local machine and open it with your favorite text editor
  2. Find “wp_widget_text_setup” function. Change “9” to “the number of text widgets you want” in this line “if ( $number > 9 ) $number = 9;”

  3. Find the “wp_widget_text_register” function. Change “9” to “the number of text widgets you want” in this line “if ( $number > 9 ) $number = 9;” and “for ($i = 1; $i <= 9; $i++)”


  4. Find “wp_widget_text_page” function. Change 10 to the number which is one higher than the number of text-widget you want in this line “<?php for ( $i = 1; $i < 10; ++$i )”. (For example, if you want 20 text widgets, set 21 in that line. )


Finally, you can upload this file to your host after editing.. (Thanks to “Syntax” for this post. I got those steps from his post in forum. ). That’s all about adding the extra text-widgets. Let me know if you have any problem with those steps that I mentioned in this post. Thanks.

Reference ~

Links ~

Leave a Reply

  1. Hi Mike,

    Long time no contact. Missing you naw.
    If I have time, I will try this widget.
    Although It is very simple and everybody can do it, as for me, using freedom to do it, I think so slowly like turtle due to connection. :P
    Nomatter what, thanks for your this post.

  2. Hey buddy, yeah.. ntnc…. miss you too.. i mailed about the commenting system of your blog but got no reply…. I was not able to drop a comment in your english blog at that time…… have you made some changes??

    >>If I have time, I will try this widget.

    cool.. Have you started using WordPress?

    >>thanks for your this post.
    Your welcome, buddy