From fed0c5df20d2fca3846224a47253ae4d3d7eea20 Mon Sep 17 00:00:00 2001 From: westi Date: Sun, 7 Dec 2008 12:14:14 +0000 Subject: [PATCH] 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 --- wp-includes/post-template.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index df161c0f00..c4b04fe88c 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -449,7 +449,7 @@ function wp_link_pages($args = '') { else $output .= ''; } - + } $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 .= '
  • ' . $link_before . $text . $link_after . '
  • '; + // 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) );