WordPress.org

Make WordPress Core

Ticket #17302: 17302.1.diff

File 17302.1.diff, 4.4 KB (added by johnpbloch, 4 years ago)

Refreshed on trunk

  • wp-includes/link-template.php

     
    14101410} 
    14111411 
    14121412/** 
     1413 * Get previous post link that is adjacent to the current post. 
     1414 * 
     1415 * @since 3.3.0 
     1416 * 
     1417 * @param string $format Optional. Link anchor format. 
     1418 * @param string $link Optional. Link permalink format. 
     1419 * @param bool $in_same_cat Optional. Whether link should be in same category. 
     1420 * @param string $excluded_categories Optional. Excluded categories IDs. 
     1421 * @return string 
     1422 */ 
     1423function get_previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
     1424        return get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true); 
     1425} 
     1426 
     1427/** 
    14131428 * Display previous post link that is adjacent to the current post. 
    14141429 * 
    14151430 * @since 1.5.0 
     1431 * @uses get_previous_post_link() 
    14161432 * 
    14171433 * @param string $format Optional. Link anchor format. 
    14181434 * @param string $link Optional. Link permalink format. 
     
    14201436 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 
    14211437 */ 
    14221438function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
    1423         adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true); 
     1439        echo get_previous_post_link($format, $link, $in_same_cat, $excluded_categories); 
    14241440} 
    14251441 
    14261442/** 
     1443 * Get previous post link that is adjacent to the current post. 
     1444 * 
     1445 * @since 3.3.0 
     1446 * 
     1447 * @param string $format Optional. Link anchor format. 
     1448 * @param string $link Optional. Link permalink format. 
     1449 * @param bool $in_same_cat Optional. Whether link should be in same category. 
     1450 * @param string $excluded_categories Optional. Excluded categories IDs. 
     1451 * @return string 
     1452 */ 
     1453function get_next_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
     1454        return get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false); 
     1455} 
     1456 
     1457/** 
    14271458 * Display next post link that is adjacent to the current post. 
    14281459 * 
    14291460 * @since 1.5.0 
     1461 * @uses get_next_post_link() 
    14301462 * 
    14311463 * @param string $format Optional. Link anchor format. 
    14321464 * @param string $link Optional. Link permalink format. 
     
    14341466 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 
    14351467 */ 
    14361468function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
    1437         adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false); 
     1469        echo get_next_post_link($format, $link, $in_same_cat, $excluded_categories); 
    14381470} 
    14391471 
    14401472/** 
    1441  * Display adjacent post link. 
     1473 * Get adjacent post link. 
    14421474 * 
    14431475 * Can be either next post link or previous. 
    14441476 * 
    1445  * @since 2.5.0 
     1477 * @since 3.3.0 
    14461478 * 
    14471479 * @param string $format Link anchor format. 
    14481480 * @param string $link Link permalink format. 
    14491481 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    14501482 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 
    14511483 * @param bool $previous Optional, default is true. Whether display link to previous post. 
     1484 * @return string 
    14521485 */ 
    1453 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { 
     1486function get_adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { 
    14541487        if ( $previous && is_attachment() ) 
    14551488                $post = & get_post($GLOBALS['post']->post_parent); 
    14561489        else 
     
    14791512        echo apply_filters( "{$adjacent}_post_link", $format, $link ); 
    14801513} 
    14811514 
     1515 
    14821516/** 
     1517 * Display adjacent post link. 
     1518 * 
     1519 * Can be either next post link or previous. 
     1520 * 
     1521 * @since 2.5.0 
     1522 * @uses get_adjacent_post_link() 
     1523 * 
     1524 * @param string $format Link anchor format. 
     1525 * @param string $link Link permalink format. 
     1526 * @param bool $in_same_cat Optional. Whether link should be in same category. 
     1527 * @param string $excluded_categories Optional. Excluded categories IDs. 
     1528 * @param bool $previous Optional, default is true. Whether display link to previous post. 
     1529 */ 
     1530function adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { 
     1531        echo get_adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, $previous ); 
     1532} 
     1533 
     1534/** 
    14831535 * Retrieve get links for page numbers. 
    14841536 * 
    14851537 * @since 1.5.0