WordPress.org

Ready to get started?Download WordPress

Forums

How to add custom css classes in menu widgets(apperance>widgets>custom menu) (1 post)

  1. harman1303
    Member
    Posted 8 months ago #

    Hi , I am Newbie to wordpress , i wanted to add a custom menu to the sidebar from widgets>custom menu option,
    My Html Code is:

    <div class="sidebar thumbnail">
    <h3>Quick Links</h3>
    <ul>
    <li class="active"><a href="#">Home</a></li>
    <li><a href="#">Location</a></li>
    <li><a href="#">Food</a></li>
    <li><a href="#">Stay</a></li>
    </ul>
    </div>

    Code that i have put it into the sidebar

    register_sidebar(
        array(
       'name' => __('Main-Sidebar-2','Bootstrap-Framwork'),
       'id' => 'main-sidebar-2',
       'description' => __('This is main Sidebar-2 content Area',''),
       'class' => 'sidebar thumbnail',
       'before_widget' => '<div class="sidebar thumbnail">',
       'after_widget' => '</div>',
       'before_title' => '<h3>',
       'after_title' => '</h3>'
    			));

    And the HTML Output that im getting is

    <div class="sidebar thumbnail"><h3>Quick Links</h3><div class="menu-test-container">
    <ul id="menu-test-1" class="menu">
    <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-4"><a href="#">Home</a></li>
    <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-5"><a href="#">About Us</a></li>
    <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-6"><a href="#">Contact us</a></li>
    </ul></div></div>

    I have googled so many times and i have tried some nav walker but nothing worked.

Reply

You must log in to post.

About this Topic