Changeset 25327
- Timestamp:
- 09/10/2013 10:11:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r25319 r25327 1338 1338 } 1339 1339 1340 /* 1341 * Get previous post link that is adjacent to the current post. 1342 * 1343 * @since 3.7.0 1344 * 1345 * @param string $format Optional. Link anchor format. 1346 * @param string $link Optional. Link permalink format. 1347 * @param bool $in_same_cat Optional. Whether link should be in same category. 1348 * @param string $excluded_categories Optional. Excluded categories IDs. 1349 * @return string 1350 */ 1351 function get_previous_post_link( $format = '« %link', $link = '%title', $in_same_cat = false, $excluded_categories = '' ) { 1352 return get_adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, true ); 1353 } 1354 1340 1355 /** 1341 1356 * Display previous post link that is adjacent to the current post. 1342 1357 * 1343 1358 * @since 1.5.0 1359 * @uses get_previous_post_link() 1344 1360 * 1345 1361 * @param string $format Optional. Link anchor format. … … 1348 1364 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1349 1365 */ 1350 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 1351 adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true); 1366 function previous_post_link( $format = '« %link', $link = '%title', $in_same_cat = false, $excluded_categories = '' ) { 1367 echo get_previous_post_link( $format, $link, $in_same_cat, $excluded_categories ); 1368 } 1369 1370 /** 1371 * Get previous post link that is adjacent to the current post. 1372 * 1373 * @since 3.7.0 1374 * @uses get_next_post_link() 1375 * 1376 * @param string $format Optional. Link anchor format. 1377 * @param string $link Optional. Link permalink format. 1378 * @param bool $in_same_cat Optional. Whether link should be in same category. 1379 * @param string $excluded_categories Optional. Excluded categories IDs. 1380 * @return string 1381 */ 1382 function get_next_post_link( $format = '« %link', $link = '%title', $in_same_cat = false, $excluded_categories = '' ) { 1383 return get_adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, false ); 1352 1384 } 1353 1385 … … 1362 1394 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1363 1395 */ 1364 function next_post_link( $format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') {1365 adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);1366 } 1367 1368 /** 1369 * Displayadjacent post link.1396 function next_post_link( $format = '%link »', $link = '%title', $in_same_cat = false, $excluded_categories = '' ) { 1397 echo get_next_post_link( $format, $link, $in_same_cat, $excluded_categories ); 1398 } 1399 1400 /** 1401 * Get adjacent post link. 1370 1402 * 1371 1403 * Can be either next post link or previous. 1372 1404 * 1373 * @since 2.5.01405 * @since 3.7.0 1374 1406 * 1375 1407 * @param string $format Link anchor format. … … 1378 1410 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1379 1411 * @param bool $previous Optional, default is true. Whether to display link to previous or next post. 1380 */ 1381 function adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) { 1412 * @return string 1413 */ 1414 function get_adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) { 1382 1415 if ( $previous && is_attachment() ) 1383 1416 $post = get_post( get_post()->post_parent ); … … 1407 1440 $adjacent = $previous ? 'previous' : 'next'; 1408 1441 1409 echo apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post ); 1442 return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post ); 1443 } 1444 1445 /** 1446 * Display adjacent post link. 1447 * 1448 * Can be either next post link or previous. 1449 * 1450 * @since 2.5.0 1451 * @uses get_adjacent_post_link() 1452 * 1453 * @param string $format Link anchor format. 1454 * @param string $link Link permalink format. 1455 * @param bool $in_same_cat Optional. Whether link should be in a same category. 1456 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1457 * @param bool $previous Optional, default is true. Whether to display link to previous or next post. 1458 * @return string 1459 */ 1460 function adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) { 1461 echo get_adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, $previous ); 1410 1462 } 1411 1463
Note: See TracChangeset
for help on using the changeset viewer.