Make WordPress Core

Ticket #10968: wp_page_menu-container.diff

File wp_page_menu-container.diff, 1.7 KB (added by paulwilde, 11 years ago)
  • wp-includes/post-template.php

    diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
    index 522ad3e..0438761 100644
    a b function wp_list_pages($args = '') { 
    879879 * <ul>
    880880 * <li><strong>sort_column</strong> - How to sort the list of pages. Defaults
    881881 * to 'menu_order, post_title'. Use column for posts table.</li>
     882 * <li><strong>menu_element</strong> - If you set this argument, it will
     883 * replace the element containing the menu with the specified HTML element.</li>
    882884 * <li><strong>menu_class</strong> - Class to use for the div ID which contains
    883885 * the page list. Defaults to 'menu'.</li>
    884886 * <li><strong>echo</strong> - Whether to echo list or return it. Defaults to
    function wp_list_pages($args = '') { 
    896898 * @return string html menu
    897899 */
    898900function wp_page_menu( $args = array() ) {
    899         $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
     901        $defaults = array(
     902                'sort_column' => 'menu_order, post_title',
     903                'menu_element' => 'div',
     904                'menu_class' => 'menu',
     905                'echo' => true,
     906                'link_before' => '',
     907                'link_after' => ''
     908        );
     909       
    900910        $args = wp_parse_args( $args, $defaults );
    901911        $args = apply_filters( 'wp_page_menu_args', $args );
    902912
    function wp_page_menu( $args = array() ) { 
    932942        if ( $menu )
    933943                $menu = '<ul>' . $menu . '</ul>';
    934944
    935         $menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
     945        $menu = '<' . $args['menu_element'] . ' class="' . esc_attr($args['menu_class']) . '">' . $menu . '</' . $args['menu_element'] . ">\n";
    936946        $menu = apply_filters( 'wp_page_menu', $menu, $args );
    937947        if ( $args['echo'] )
    938948                echo $menu;