Ticket #8298: 8298.2.diff
File 8298.2.diff, 1.6 KB (added by , 14 years ago) |
---|
-
wp-includes/post-template.php
825 825 * @param array|string $args 826 826 */ 827 827 function wp_page_menu( $args = array() ) { 828 $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', ' echo' => true, 'link_before' => '', 'link_after' => '');828 $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'include' => '', 'exclude' => '', 'echo' => true, 'link_before' => '', 'link_after' => ''); 829 829 $args = wp_parse_args( $args, $defaults ); 830 830 $args = apply_filters( 'wp_page_menu_args', $args ); 831 831 … … 843 843 if ( is_front_page() && !is_paged() ) 844 844 $class = 'class="current_page_item"'; 845 845 $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>'; 846 847 // Because include overrides subpages, we need to reverse engineer the include as exclude 848 $include = is_array( $args['include'] ) ? $args['include'] : (array) $args['include']; 849 $exclude = is_array( $args['exclude'] ) ? $args['exclude'] : (array) $args['exclude']; 850 $pages = get_pages(); 851 foreach( $pages as $page ) { 852 if( !in_array( $page->ID, $include ) ) 853 $exclude[] = $page->ID; 854 } 855 $list_args['exclude'] = implode( ',', $exclude ); 856 846 857 // If the front page is a page, add it to the exclude list 847 858 if (get_option('show_on_front') == 'page') { 848 859 if ( !empty( $list_args['exclude'] ) ) {