Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

what's the best approach to add more widget areas to a theme? currently, my theme has 2 columns that display the widgets, but I'd like to extend it to 4 for example.

It currently looks like this: enter image description here

And I'd like it to look like this: enter image description here

All the widgets of this theme are located above the footer. The theme is called Time by s5themes.com. The widget initializer is not located in the functions.php as far as I know. Is this a simple fix at all? thanks!

Edit: Now that the sidebar is displaying in the theme, I think the rest of how each sidebar is shown is located in the style.css. Thanks.

share|improve this question
    
Best for what? What are the alternatives you may select from? –  Mark Kaplun Jan 24 at 8:37
    
Basically, I just want to be able to display something like the picture I showed. I tried adding one more widget function to where the widgets are managed (widget.php in theme/admin/inc) with no result. –  shesmovedon Jan 25 at 4:27
    
because you need to add sidebars and not widgets. What is wrong with Manolo's answer? –  Mark Kaplun Jan 25 at 4:34
    
have you read a tutorial on how to add sidebars and widgets? –  Mark Kaplun Jan 25 at 4:37
    
Because adding a sidebar in the admin is just the first step, now you need to change the theme's code to display the sidebars. –  Mark Kaplun Jan 25 at 5:11

1 Answer 1

up vote 1 down vote accepted

You have to add this code in the functions.php file:

/**
 * Register new sidebar
 *
 */
function new_sidebar_widget_init() {

register_sidebar( array(
    'name' => 'new-sidebar',
    'id' => 'new-sidebar',
    'before_widget' => '<div id="new-sidebar">',
    'after_widget' => '</div>',
    'before_title' => '',
    'after_title' => '',
) );
}
add_action( 'widgets_init', 'new_sidebar_widget_init' );

and then call the sidebar from a template to display it:

<?php  dynamic_sidebar( 'new-sidebar' ); ?>
share|improve this answer
    
As in my post, the widgets in this theme are managed on a widget.php file and not in the functions.php. I tried adding the code above anyway to no avail. Also tried adding it in the widget.php file also with no luck. Thanks –  shesmovedon Jan 25 at 4:32
    
@manolo, this is half an answer, to make it a full one you should also explain how to get the sidebar to be displayed on the frontend. –  Mark Kaplun Jan 25 at 5:12
    
@MarkKaplun - Done it. –  Manolo Jan 25 at 6:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.