How can I edit the HTML output of sidebar in WordPress?

Alright so i am trying to change the HTML output for wordpress sidebars.

I tried using: register_sidebar(); and use after/before title and after/before widget.

Read More

The above does work to some extent however the way that the HTML output is now it’s missing the body of the widget and i would like to edit it and add a div wrapping the body of the widget.

Right now its.

 <div class="beforewidget">
      <div class="title">
      </div>

      // content of the widget
 </div>

I want to change it so the content of the widget would be wrapped with div as well.

Here is my register_sidebar()

 $args = array(
'name'          => __( 'Normal Sidebar', 'theme_text_domain' ),
'id'            => '3',
'description'   => 'Normal Sidebar',
    'class'         => '',
'before_widget' => '<div class="widget-body">',
'after_widget'  => '</div>',
'before_title'  => '<div class="widget-title">',
'after_title'   => '</div>' );
register_sidebar( $args );

Which file do I need to edit?

Related posts

Leave a Reply

1 comment

  1.  $args = array(
    'name'          => __( 'Normal Sidebar', 'theme_text_domain' ),
    'id'            => '3',
    'description'   => 'Normal Sidebar',
    'class'         => '',
    'before_widget' => '</div><div class="widget-body">',
    'after_widget'  => '</div>',
    'before_title'  => '<div class="widget-title">',
    'after_title'   => '' );
    

    try that