Another WordPress Development Blog

Using Widgets inside a WordPress theme


We all know what the wordpress widgets are. And we all appreciate the drag and drop and management simplicity. But very few think about using them outside their usual place which is the sidebar (or footer on some themes).

If you are doing a magazine theme you can use the widgets inside the content area. Here is how you can do it

First “register ” the widget area . Insert this code in functions.php

register_sidebar(array('name' => New widget area,
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''));

After that you need to open the file that will keep the widget area and paste this code in the right place.

if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(2) ) : ?>

Save and go to Widgets area in admin to use the created zone.

Random Posts

Leave a Reply