How to Add Extra Widget Section In WordPress Blog

How to Add Extra Widget Section In WordPress Blog

Generally, in the default WordPress themes, the sidebar contains the widget sections where you can easily add some script or block to highlight your blog content. In widget section you can show your recent posts, recent comments, or customized features dynamically just adding some plug-in or php code in the widget section from your administrator panel. But if you decide to add an extra widget section in any where within your blog, may be you get some problem. WordPress doesn’t allow you to add the widget section as usual.

Related : Add Digsby Widget In Your Blog.

Firstly, you have to register the widget section that you want to add in your theme function (Function.php).

How to add an extra widgets in your WordPress blog
Generally, the WordPress free themes are widget ready. The number of inbuilt widget sections is maximum 3. But you can increase that number by registering them in the Function.php of your blog theme.

Register your widget in Function.php
Suppose you want to add a widget in the footer section in your blog named footer-widget. At first take a backup of your theme folder using FTP. Open the function.php (/wp-content/themes/your_theme/function.php) and look for the code below:

if ( function_exists(‘register_sidebar’) ){ register_sidebar(array( ‘before_widget’ => ”, ‘after_widget’ => ”, ‘before_title’ => ‘

‘, ‘after_title’ => ‘

‘, ));
After the above code just add the following code

register_sidebar(array( ‘name’ => ‘footer-widget’, ‘before_widget’ => ”, ‘after_widget’ => ”, ‘before_title’ => ‘

‘, ‘after_title’ => ‘

‘ ));
Save it or update it. Note that I’ve registered the widget “footer-widget”. You can give any name.

Editing theme template
After registering the widget section you have to call the function in your theme template where you want to display it. For instance I’ll call that function from the footer template (footer.php). Add the following code where you want to show the widget section.

Click to view the code.

Now save the template.

Adding some styling rule in the style-sheet template
You have just added the widget in the proper place of your theme template. Now the last job is to add some rules in your style-sheet (style.css). Open style.css and add the following codes (you can also customize it).

footer-widget { background:#F7F7F7; width:200px; height:200px; }

You are done. To see the effect open the widget section from your WordPress admin panel. If you are using WordPress 2.8 or higher, then it should be here:

add-extra-widget

Click on “Widgets” and you can see the list of the widgets section.

add-extra-widget-1

Find the widget section that you’ve just added. Enjoy your new widget section. Add any widget by dragging them in the widget section.

Feel free to share your problems or suggestions in the comment section.

Be the first to comment

Leave a Reply

Your email address will not be published.


*