Changeset 8848
- Timestamp:
- 09/08/2008 06:56:54 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r8847 r8848 622 622 } 623 623 624 /** 625 * Create menu of pages 626 * 627 * @since 2.7.0 628 * 629 * @param array|string $args 630 */ 631 function wp_page_menu( $args = array() ) { 632 $defaults = array('title_li' => '', 'sort_column' => 'menu_order', 'menu_class' => 'menu', 'echo' => false); 633 $args = wp_parse_args( $args, $defaults ); 634 $args = apply_filters( 'wp_page_menu_args', $args ); 635 636 $menu = ''; 637 638 // Show Home in the menu 639 if ( !empty($args['show_home']) ) { 640 if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) 641 $text = __('Home'); 642 else 643 $text = $args['show_home']; 644 $class = ''; 645 if ( is_home() && !is_paged() ) 646 $class = 'class="current_page_item"'; 647 $menu = '<li ' . $class . '><a href="' . get_option('home') . '">' . $text . '</a></li>'; 648 } 649 650 $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($args) ); 651 652 if ( $menu ) 653 $menu = '<ul>' . $menu . '</ul>'; 654 655 $menu = '<div id="' . $args['menu_class'] . '">' . $menu . "</div>\n"; 656 echo apply_filters( 'wp_page_menu', $menu ); 657 } 658 624 659 // 625 660 // Page helpers
Note: See TracChangeset
for help on using the changeset viewer.