Add class to <ul> on sidebar widget

by user8463989   Last Updated July 12, 2019 08:08 AM

I have been looking on stack overflow and the web but can't find a simple solution for this.

I just want to add a class to the of the widget sidebar generated by Wordpress.

This is my register sidebar code:

    register_sidebar( array(
    'name' => __(' Main Sidebar ', 'mystic'),
    'id' => 'sidebar-2',
    'class' => 'submenu',
    'description' => __( 'Main Sidebar', 'mystic' ),
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h6>',
    'after_title' => '</h6>'

The html output of the actual unordered list is:

        <a href="http://localhost:8888/a-third-post/">A Third Post</a>
        <a href="http://localhost:8888/another-post/">Another Post</a>
        <a href="http://localhost:8888/news-article-title/">News Article Title</a>

But I want the ul to have a class of 'submenu'


<ul class="submenu">

Surely there has to be an easy way to do this?(without jQuery)

Related Questions

Updated January 26, 2018 09:08 AM

Updated February 23, 2018 15:08 PM

Updated December 01, 2017 16:08 PM

Updated May 01, 2019 20:08 PM

Updated February 28, 2017 14:08 PM