Advertisement
ellm

WP – pages_from_nav walker class

Oct 5th, 2012
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. class pages_from_nav extends Walker_Nav_Menu
  2.                             {
  3.                                 function start_el(&$output, $item, $depth, $args)
  4.                                 {
  5.                                     $parentPageID = get_the_ID();
  6.                                      global $wp_query;
  7.                                      if ($item->post_parent == $parentPageID) {
  8.                                       $item_output .= $item->object_id;
  9.                                       $item_output .= ",";  
  10.                                      }
  11.  
  12.  
  13.                                       $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  14.                                 }
  15.                             }
  16.  
  17.                             function jawonio_pages_from_nav() {
  18.                                 wp_nav_menu(array(
  19.                                     'menu'            => 'Main Navigation',
  20.                                     'container'       => '',
  21.                                     'menu_id'         => 'site-nav',
  22.                                     'depth'           => 0,
  23.                                     'walker'          => new pages_from_nav()
  24.                                     ));
  25.                             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement