Make wp_page_menu() respect is_front_page(). Fixes #8469 props AaronCampbell.
git-svn-id: https://develop.svn.wordpress.org/trunk@10115 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4cc937b4d3
commit
c7077d18a3
|
@ -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