phphtmlcsswordpresssuperfish

Super Fish Menu in wordpress


I have made theme in WordPress where I am using Super Fish menu problem is it is working perfectly but when I make it responsive to mobile view it disappear, but on html it is working perfectly. I am using following codes. I also tried bootstrap_navwalker but I could not manage to put data-type in my <ul>.

if ( function_exists('wp_nav_menu') ) {
    wp_nav_menu( array(
        'theme_location' => 'primary',
        'sort_column' => 'menu_order',
        'menu_class' => 'sf-menu',
        'fallback_cb' => 'default_menu'
    ));
}

Following is html code which is working perfectly good.

   <nav class="nav">
                    <!--Sf-menu-->
                    <ul class="sf-menu" data-type="navbar">
                        <li>
                            <a href="./">Home</a>
                        </li>
                        <li class="active">
                            <a href="index-1.html">About</a>
                            <ul>
                                <li>
                                    <a href="#">News</a>
                                </li>
                                <li>
                            </ul>
                        </li>
                    </ul>
                    <!--End Sf-menu-->
                </nav>

I checked many posts even some here but all talk about putting in wordpress but now about making it responsive even some tutorials also show how to put on wordpress but not how to make mobile menu. Thanks for help


Solution

  • After playing a lot with nav_walker got solution from other post where he used simple 'item-wrap' to wrap and change ul and add data-type=navbar attribute. Now it is working perfectly. Thank you very much for you guys help.

    if ( function_exists('wp_nav_menu') ) {
        wp_nav_menu( array(
            'theme_location' => 'primary',
            'sort_column' => 'menu_order',
            'items_wrap' => '<ul id="%1$s" class="%2$s sf-menu" data-type="navbar" >%3$s</ul>',
            'fallback_cb' => 'default_menu'
        ));
    }
    

    In items_wrap I added my data-type="navbar" so all is working perfectly.