mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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
@ -669,6 +669,8 @@ function wp_page_menu( $args = array() ) {
|
|||||||
|
|
||||||
$menu = '';
|
$menu = '';
|
||||||
|
|
||||||
|
$list_args = $args;
|
||||||
|
|
||||||
// Show Home in the menu
|
// Show Home in the menu
|
||||||
if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
|
if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
|
||||||
if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $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
|
else
|
||||||
$text = $args['show_home'];
|
$text = $args['show_home'];
|
||||||
$class = '';
|
$class = '';
|
||||||
if ( is_home() && !is_paged() )
|
if ( is_front_page() && !is_paged() )
|
||||||
$class = 'class="current_page_item"';
|
$class = 'class="current_page_item"';
|
||||||
$menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $link_before . $text . $link_after . '</a></li>';
|
$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['echo'] = false;
|
||||||
$list_args['title_li'] = '';
|
$list_args['title_li'] = '';
|
||||||
$menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
|
$menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
|
||||||
|
Loading…
Reference in New Issue
Block a user