• Resolved betyonfire

    (@betyonfire)


    Hi,

    I need to add a third level to the bootstrap menu in devdembootstrap3 and I’ve done this using SmartMenus (https://www.smartmenus.org/), but I need to make some changes to the wp_bootstrap_navwalker.php file. I tried moving this into my child theme in a /lib/ directory, but it’s not being picked up. I see there is a require_once call to it in the functions.php file in the parent theme. Is there anyway to override this and use the version in my child theme?

    Many thanks for any advice!

Viewing 1 replies (of 1 total)
  • Theme Author DevDm

    (@devdm)

    Yes betyonfire,

    You can dose these nav flames by duplicating template-part-topnav.php or template-part-footernav.php into your child theme and modifying wp_nav_menu to your custom nav walker.

    The WordPress child theme system doesn’t just look for any old file when it comes to the hierarchy in child themes. Only WordPress specific template files.

    So this inside template-part-topnav.php…

    <?php
                    wp_nav_menu( array(
                            'theme_location'    => 'main_menu',
                            'depth'             => 2,
                            'container'         => 'div',
                            'container_class'   => 'collapse navbar-collapse navbar-1-collapse',
                            'menu_class'        => 'nav navbar-nav',
                            'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                            'walker'            => new wp_bootstrap_navwalker())
                    );
                    ?>

    Turns into this (where we change ‘walker’ to your custom one which you need to include in your child theme’s functions.php file).

    <?php
                    wp_nav_menu( array(
                            'theme_location'    => 'main_menu',
                            'depth'             => 2,
                            'container'         => 'div',
                            'container_class'   => 'collapse navbar-collapse navbar-1-collapse',
                            'menu_class'        => 'nav navbar-nav',
                            'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                            'walker'            => new wp_betysflaminhot_navwalker())
                    );
                    ?>

    hope this helps. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Changing navwalker.php in child theme’ is closed to new replies.