After [34200], force 'before' and 'after' to <ul> and </ul> when wp_nav_menu() falls back to wp_page_menu().

See #11095.


git-svn-id: https://develop.svn.wordpress.org/trunk@34653 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-27 23:38:32 +00:00
parent 8594d93d7b
commit a155c5dcfd

View File

@ -1264,10 +1264,21 @@ function wp_page_menu( $args = array() ) {
$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) );
$container = sanitize_text_field( $args['container'] );
if ( $menu ) { if ( $menu ) {
// wp_nav_menu doesn't set before and after
if ( isset( $args['fallback_cb'] ) &&
'wp_page_menu' === $args['fallback_cb'] &&
'ul' !== $container ) {
$args['before'] = '<ul>';
$args['after'] = '</ul>';
}
$menu = $args['before'] . $menu . $args['after']; $menu = $args['before'] . $menu . $args['after'];
} }
$container = sanitize_text_field( $args['container'] );
$attrs = ''; $attrs = '';
if ( ! empty( $args['menu_id'] ) ) { if ( ! empty( $args['menu_id'] ) ) {
$attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"'; $attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"';