How to customize widgets Wordpress?

I'm writing a theme on _s and bootstrap use there.

So, faced with such a problem. Can't figure out how to customize widgets.
For example the widget menu. Menu looks like menu bootstrap are applied to it required classes.

Until I came up with this:

1) disabling the standard widgets in functions.php the function unregister_widget('WP_Nav_Menu_Widget');

2) Copy the file class-wp-nav-menu-widget.php rename it appending the prefix custom

3) Edit and add the desired css classes.

I can not understand where these classes live.. poke a finger fool. What generates the html markup? Or offer an alternative solution.
July 9th 19 at 11:03
3 answers
July 9th 19 at 11:05
Depends on the widget. With regard to the menu you want to use a custom Walker's, for bootstrap is ready. To the rest of the widgets at will. If you want to customize only the container in which the widget is you can get into functions.php to create a new sidebar \ change existing (as suggested above), and add the desired markup in the properties before_widget \ after_widget. Don't forget to put it in the class list %1$s %2$s is important. Then there are two ways my and wrong:
- tightly specify the desired classes in bootstrap functions.php in the previous step
- install the plugin Widget CSS Classes, and then, when adding the widgets in admin area, you will receive the ability to specify css classes bootstrap for each widget. For example, each widget can be represented as one column. Needless to say, this is the right way.

Also required classes you can register in the theme template "wrapping" sidebar in the right div if the epic above somehow does not fit.

But to create an entirely custom widget, with your markup, you need to create your own classes and register them in the proverbial functions.php. This is a separate issue, and if the point is only the design, you don't need.
July 9th 19 at 11:07
Easier IMHO to display the menu using 'bootstrap class'); ?>
July 9th 19 at 11:09
To register your sidebar (html tags are widgets) and display it in the template
Read more
register_my_widgets function(){
 register_sidebar( array(
 'name' => sprintf(__('Sidebar %d'), $i ),
 'id' => "sidebar-$i",
 'description' => ",
 'class' => ",
 'before_widget' => '<li id="%1$s" class="widget %2$s">',
 'after_widget' => "</li>\n",
 'before_title' => '<h2 class="widgettitle">',
 'after_title' => "</h2>\n",
 ) );
add_action( 'widgets_init', 'register_my_widgets' );

With a menu to register the menu, then bring it
Read more

Find more questions by tags PHPWordPress