Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class pages_from_nav extends Walker_Nav_Menu
- {
- function start_el(&$output, $item, $depth, $args)
- {
- $parentPageID = get_the_ID();
- global $wp_query;
- if ($item->post_parent == $parentPageID) {
- $item_output .= $item->object_id;
- $item_output .= ",";
- }
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
- }
- }
- function jawonio_pages_from_nav() {
- wp_nav_menu(array(
- 'menu' => 'Main Navigation',
- 'container' => '',
- 'menu_id' => 'site-nav',
- 'depth' => 0,
- 'walker' => new pages_from_nav()
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement