Changeset 38523 for trunk/src/wp-includes/post-template.php
- Timestamp:
- 09/06/2016 09:05:45 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r38371 r38523 1139 1139 * @type string $title_li List heading. Passing a null or empty value will result in no heading, and the list 1140 1140 * will not be wrapped with unordered list `<ul>` tags. Default 'Pages'. 1141 * @type string $item_spacing Whether whitespace format the menu's HTML: 'discard' or 'preserve' (default). 1141 1142 * @type Walker $walker Walker instance to use for listing pages. Default empty (Walker_Page). 1142 1143 * } … … 1150 1151 'title_li' => __( 'Pages' ), 'echo' => 1, 1151 1152 'authors' => '', 'sort_column' => 'menu_order, post_title', 1152 'link_before' => '', 'link_after' => '', ' walker' => '',1153 'link_before' => '', 'link_after' => '', 'item_spacing' => 'preserve', 'walker' => '', 1153 1154 ); 1154 1155 1155 1156 $r = wp_parse_args( $args, $defaults ); 1157 1158 if ( ! in_array( $r['item_spacing'], array( 'preserve', 'discard' ), true ) ) { 1159 // invalid value, fall back to default. 1160 $r['item_spacing'] = $defaults['item_spacing']; 1161 } 1156 1162 1157 1163 $output = ''; … … 1231 1237 * Optional. Arguments to generate a page menu. See wp_list_pages() for additional arguments. 1232 1238 * 1233 * @type string $sort_column How to short the list of pages. Accepts post column names. 1234 * Default 'menu_order, post_title'. 1235 * @type string $menu_id ID for the div containing the page list. Default is empty string. 1236 * @type string $menu_class Class to use for the element containing the page list. Default 'menu'. 1237 * @type string $container Element to use for the element containing the page list. Default 'div'. 1238 * @type bool $echo Whether to echo the list or return it. Accepts true (echo) or false (return). 1239 * Default true. 1240 * @type int|bool|string $show_home Whether to display the link to the home page. Can just enter the text 1241 * you'd like shown for the home link. 1|true defaults to 'Home'. 1242 * @type string $link_before The HTML or text to prepend to $show_home text. Default empty. 1243 * @type string $link_after The HTML or text to append to $show_home text. Default empty. 1244 * @type string $before The HTML or text to prepend to the menu. Default is '<ul>'. 1245 * @type string $after The HTML or text to append to the menu. Default is '</ul>'. 1246 * @type Walker $walker Walker instance to use for listing pages. Default empty (Walker_Page). 1239 * @type string $sort_column How to short the list of pages. Accepts post column names. 1240 * Default 'menu_order, post_title'. 1241 * @type string $menu_id ID for the div containing the page list. Default is empty string. 1242 * @type string $menu_class Class to use for the element containing the page list. Default 'menu'. 1243 * @type string $container Element to use for the element containing the page list. Default 'div'. 1244 * @type bool $echo Whether to echo the list or return it. Accepts true (echo) or false (return). 1245 * Default true. 1246 * @type int|bool|string $show_home Whether to display the link to the home page. Can just enter the text 1247 * you'd like shown for the home link. 1|true defaults to 'Home'. 1248 * @type string $link_before The HTML or text to prepend to $show_home text. Default empty. 1249 * @type string $link_after The HTML or text to append to $show_home text. Default empty. 1250 * @type string $before The HTML or text to prepend to the menu. Default is '<ul>'. 1251 * @type string $after The HTML or text to append to the menu. Default is '</ul>'. 1252 * @type string $item_spacing Whether whitespace format the menu's HTML: 'discard' or 'preserve' (default). 1253 * @type Walker $walker Walker instance to use for listing pages. Default empty (Walker_Page). 1247 1254 * } 1248 1255 * @return string|void HTML menu … … 1250 1257 function wp_page_menu( $args = array() ) { 1251 1258 $defaults = array( 1252 'sort_column' => 'menu_order, post_title', 1253 'menu_id' => '', 1254 'menu_class' => 'menu', 1255 'container' => 'div', 1256 'echo' => true, 1257 'link_before' => '', 1258 'link_after' => '', 1259 'before' => '<ul>', 1260 'after' => '</ul>', 1261 'walker' => '', 1259 'sort_column' => 'menu_order, post_title', 1260 'menu_id' => '', 1261 'menu_class' => 'menu', 1262 'container' => 'div', 1263 'echo' => true, 1264 'link_before' => '', 1265 'link_after' => '', 1266 'before' => '<ul>', 1267 'after' => '</ul>', 1268 'item_spacing' => 'discard', 1269 'walker' => '', 1262 1270 ); 1263 1271 $args = wp_parse_args( $args, $defaults ); 1272 1273 if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ) ) ) { 1274 // invalid value, fall back to default. 1275 $args['item_spacing'] = $defaults['item_spacing']; 1276 } 1277 1278 if ( 'preserve' === $args['item_spacing'] ) { 1279 $t = "\t"; 1280 $n = "\n"; 1281 } else { 1282 $t = ''; 1283 $n = ''; 1284 } 1264 1285 1265 1286 /** … … 1301 1322 $list_args['echo'] = false; 1302 1323 $list_args['title_li'] = ''; 1303 $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args));1324 $menu .= wp_list_pages( $list_args ); 1304 1325 1305 1326 $container = sanitize_text_field( $args['container'] ); … … 1316 1337 'wp_page_menu' === $args['fallback_cb'] && 1317 1338 'ul' !== $container ) { 1318 $args['before'] = '<ul>';1339 $args['before'] = "<ul>{$n}"; 1319 1340 $args['after'] = '</ul>'; 1320 1341 } … … 1332 1353 } 1333 1354 1334 $menu = "<{$container}{$attrs}>" . $menu . "</{$container}> \n";1355 $menu = "<{$container}{$attrs}>" . $menu . "</{$container}>{$n}"; 1335 1356 1336 1357 /**
Note: See TracChangeset
for help on using the changeset viewer.