Wordpress Footer Widget Processing

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.

Example:

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.

Topic outside-wordpress widgets design theme-development Wordpress

Category Web


In your sidebar array as an example:

    register_sidebar(array(
    '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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.