Make WordPress Core

Ticket #10968: post-template.php.diff

File post-template.php.diff, 1.5 KB (added by stebbiv, 15 years ago)

A simplified diff. Now container_element simply defaults to 'div'

  • wp-includes/post-template.php

     
    804804 * <li><strong>show_home</strong> - If you set this argument, then it will
    805805 * display the link to the home page. The show_home argument really just needs
    806806 * to be set to the value of the text of the link.</li>
     807 * <li><strong>container_element</strong> - If you set this argument, it will
     808 * replace the div-element containing the menu with the specified HTML element.
     809 * Defaults to 'div'.</li>
    807810 * </ul>
    808811 *
    809812 * @since 2.7.0
     
    811814 * @param array|string $args
    812815 */
    813816function wp_page_menu( $args = array() ) {
    814         $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
     817        $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '', 'container_element' => 'div');
    815818        $args = wp_parse_args( $args, $defaults );
    816819        $args = apply_filters( 'wp_page_menu_args', $args );
    817820
     
    847850        if ( $menu )
    848851                $menu = '<ul>' . $menu . '</ul>';
    849852
    850         $menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
     853        $menu = '<'.$list_args['container_element'].' class="' . $args['menu_class'] . '">' . $menu . '</'.$list_args['container_element'].'>'."\n";
    851854        $menu = apply_filters( 'wp_page_menu', $menu, $args );
    852855        if ( $args['echo'] )
    853856                echo $menu;