Make wp_page_menu() respect is_front_page(). Fixes #8469 props AaronCampbell.
git-svn-id: http://svn.automattic.com/wordpress/trunk@10115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
350be7f979
commit
fed0c5df20
|
@ -449,7 +449,7 @@ function wp_link_pages($args = '') {
|
|||
else
|
||||
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$output .= $link_before;
|
||||
$output .= $j;
|
||||
|
@ -669,6 +669,8 @@ function wp_page_menu( $args = array() ) {
|
|||
|
||||
$menu = '';
|
||||
|
||||
$list_args = $args;
|
||||
|
||||
// Show Home in the menu
|
||||
if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
|
||||
if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
|
||||
|
@ -676,12 +678,20 @@ function wp_page_menu( $args = array() ) {
|
|||
else
|
||||
$text = $args['show_home'];
|
||||
$class = '';
|
||||
if ( is_home() && !is_paged() )
|
||||
if ( is_front_page() && !is_paged() )
|
||||
$class = 'class="current_page_item"';
|
||||
$menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $link_before . $text . $link_after . '</a></li>';
|
||||
// If the front page is a page, add it to the exclude list
|
||||
if (get_option('show_on_front') == 'page') {
|
||||
if ( !empty( $list_args['exclude'] ) ) {
|
||||
$list_args['exclude'] .= ',';
|
||||
} else {
|
||||
$list_args['exclude'] = '';
|
||||
}
|
||||
$list_args['exclude'] = get_option('page_on_front');
|
||||
}
|
||||
}
|
||||
|
||||
$list_args = $args;
|
||||
$list_args['echo'] = false;
|
||||
$list_args['title_li'] = '';
|
||||
$menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
|
||||
|
|
Loading…
Reference in New Issue