1

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.

6
  • Best for what? What are the alternatives you may select from? Commented Jan 24, 2014 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.
    – jjcastil
    Commented Jan 25, 2014 at 4:27
  • because you need to add sidebars and not widgets. What is wrong with Manolo's answer? Commented Jan 25, 2014 at 4:34
  • have you read a tutorial on how to add sidebars and widgets? Commented Jan 25, 2014 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. Commented Jan 25, 2014 at 5:11

1 Answer 1

1

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' ); ?>
3
  • 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
    – jjcastil
    Commented Jan 25, 2014 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. Commented Jan 25, 2014 at 5:12
  • @MarkKaplun - Done it.
    – Manolo
    Commented Jan 25, 2014 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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