WordPress.org

Make WordPress Core

Ticket #8298: 8298-2.diff

File 8298-2.diff, 1020 bytes (added by technosailor, 8 years ago)
  • wp-includes/post-template.php

     
    827827                if ( is_front_page() && !is_paged() )
    828828                        $class = 'class="current_page_item"';
    829829                $menu .= '<li ' . $class . '><a href="' . home_url() . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
     830               
     831                // Because include overrides subpages, we need to reverse engineer the include as exclude
     832                if( !is_array( $args['included'] ) )
     833                        $included = (array) $included;
     834                $pages = get_pages();
     835                $exclude = array();
     836                foreach( $pages as $page )
     837                {
     838                        if( !in_array( $page->ID, $included ) )
     839                                $exclude[] = $page->ID;
     840                }
     841                $list_args['exclude'] = implode( ',', $exclude );
     842               
    830843                // If the front page is a page, add it to the exclude list
    831844                if (get_option('show_on_front') == 'page') {
    832845                        if ( !empty( $list_args['exclude'] ) ) {