daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.     $companyNav = wp_get_nav_menu_items('Primary Navigation');
  4.     var_dump($companyNav);
  5.     foreach ( $companyNav as $navItem ) :
  6.       //var_dump($navItem);
  7.       // item does not have a parent so menu_item_parent equals 0 (false)
  8.       if ( !$navItem->menu_item_parent ):
  9.         echo '<li>';
  10.           echo '<a href="'.$navItem->url.'" title="'.$navItem->title.'">'.$navItem->title.'</a>'; //</a>
  11.           echo '<ul class="sub-menu">';//<ul>
  12.             foreach ( $companyNav as $submenuNavItem ) :
  13.               if ( $submenuNavItem->menu_item_parent == $navItem->ID ):
  14.  
  15.                   echo '<li>';
  16.                     echo '<a href="'.$submenuNavItem->url.'" title="'.$submenuNavItem->title.'">'.$submenuNavItem->title.'</a>'; //</a>
  17.                     echo '<ul class="sub-menu">';
  18.                       echo '<li>';
  19.                       foreach ( $companyNav as $tertiaryNavItem ) :
  20.                         if ( $tertiaryNavItem->menu_item_parent == $submenuNavItem->ID ):
  21.                           echo '<a href="'.$tertiaryNavItem->url.'" title="'.$tertiaryNavItem->title.'">'.$tertiaryNavItem->title.'</a>';
  22.                         endif;//$tertiaryNavItem->menu_item_parent == $submenuNavItem->ID
  23.                       endforeach;//$companyNav as $tertiaryNavItem
  24.                       echo '</li>';
  25.                     echo '</ul>';
  26.                   echo '</li>';
  27.               endif;//$submenuNavItem->menu_item_parent == $navItem->ID
  28.             endforeach;//$companyNav as $submenuNavItem
  29.           echo '</ul>';// </ul>
  30.         echo '</li>';// li-1
  31.       endif;//!$navItem->menu_item_parent
  32.     endforeach;//$companyNav as $navItemarray_unique (
  33.   ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top