I made a sidebar in wordpress and have widgets in it, I want to process them one by one so that I can set their locations in theme according to me.


If I have a 3 widget in my footer sidebar, they come in one row and if fourth came it goes to next row but in the centre.

Secondly if there is only one widget in sidebar it comes in the centre of first row.

I am using bootstrap with LESS, How can I get the done.

1 Answer 1


In your sidebar array as an example:

    'id' => 'footer',
    'name' => 'Footer',
    'before_widget' => '<div id="%1$s" class="widget col-sm-4 %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h4 class="widgettitle">',
    'after_title' => '</h4>',

Don't worry about wrapping the sidebar in a row. Let this do it for you. See, the col-sm-4 (or whatever size, with 4) would make every widget in the Footer have a width of 4 columns.

You would need to provide more theme code for us to provide a more descriptive answer, as your theme setup and inter-dependencies might be an additional cause for error.

Your Answer

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

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