function widget($args, $instance) { global $post; $children = wp_list_pages('echo=0&child_of=' . $post->ID . '&title_li='); if ($children) { $parent = $post->ID; } else { $parent = $post->post_parent; if (!$parent) { $parent = $post->ID; } } $parent_title = get_the_title($parent); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? $parent_title : $instance['title'], $instance, $this->id_base); $sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby']; $exclude = empty($instance['exclude']) ? theme_get_excluded_pages() : $instance['exclude'] . ',' . theme_get_excluded_pages(); $output = wp_list_pages(array('title_li' => '', 'echo' => 0, 'child_of' => $parent, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => 1)); if (!empty($output)) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul> <?php echo $output; ?> </ul> <?php echo $after_widget; } }
function menu() { if (theme_get_option('general', 'enable_nav_menu') && has_nav_menu('primary-menu')) { wp_nav_menu(array('theme_location' => 'primary-menu', 'container' => 'nav', 'container_id' => 'navigation', 'container_class' => 'jqueryslidemenu', 'fallback_cb' => '')); } else { $excluded_pages_with_childs = theme_get_excluded_pages(); $active_class = is_front_page() ? 'class="current_page_item"' : ''; $output = '<nav id="navigation" class="jqueryslidemenu">'; $output .= '<ul id="menu-navigation" class="menu">'; $output .= '<li><a ' . $active_class . ' href="' . get_option('home') . '">' . __('Home', 'striking_front') . '</a></li>'; $output .= wp_list_pages("sort_column=menu_order&exclude={$excluded_pages_with_childs}&title_li=&echo=0&depth=4"); $output .= '</ul>'; $output .= '</nav>'; echo $output; } }