I'm trying to make the navigation with different structures using walker class but I got stuck.

Here's the code of what should the html output

<nav class="main-nav">
    <div class="container-custom">
        <div class="row">
                <div class="col-sm-2 col-sm-push-5 text-center">
                    <a href="index.php" id="main-nav-link" class="logo"><img src="img/image.png" width="100" height="100" alt="Logo"></a>
                    <button id="menu-trigger" class="menu-trigger visible-xs"><i class="fa fa-bars fa-2x"></i></button>
                <div class="mob-menu-bg">
                    <div class="col-sm-5 col-sm-pull-2 left text-center">
                        <li><a href="portrait.php" id="main-nav-link">Portrait</a></li>
                        <li><a href="repertoire.php" id="main-nav-link">Repertoire</a></li>
                        <li><a href="kundenresumes.php" id="main-nav-link">Kundenresumés</a></li>
                    <div class="col-sm-5 col-sm-push-0 col-sm-pull-0 right text-center">
                        <li><a href="duo.php" id="main-nav-link">Duo</a></li>
                        <li><a href="referenzen.php" id="main-nav-link">Referenzen</a></li>
                        <li><a href="kontakt.php" id="main-nav-link">Kontakt</a></li>

My question is how to add the additional containers using walker class? How to implement this? How to customize it in Admin panel?

php walker class:

 class Walker_Main_Nav extends Walker_Nav_Menu {

  function start_lvl( &$output, $depth ) {
        $indent = str_repeat("\t", $depth);
        $output .= "\n$indent<ul>\n";

  function start_lvl( &$output, $item, $args = [], $id = 0 ) {


  // function end_el() {
  // }

  function end_lvl( &$output, $depth ) {
        $output .= "\n$indent</ul>\n";

note: the navigation that I'm trying to do is similar to this website https://grannys.ca/

  • Where you got stuck? Please show the code you've written so far to give us an idea where you stand. – David Jan 20 '16 at 9:40
  • I edited the question, you can see the php code – Mustafa Najjar Jan 20 '16 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.