Ticket #19652: 19652-patch.diff
| File 19652-patch.diff, 2.8 KB (added by , 14 years ago) |
|---|
-
wp-includes/link-template.php
1310 1310 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1311 1311 */ 1312 1312 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 1313 adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);1313 echo get_previous_post_link( $format, $link, $in_same_cat, $excluded_categories ); 1314 1314 } 1315 1315 1316 1316 /** 1317 * needs-docs if accepted... 1318 */ 1319 function get_previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 1320 return adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, true, true ); 1321 } 1322 1323 /** 1317 1324 * Display next post link that is adjacent to the current post. 1318 1325 * 1319 1326 * @since 1.5.0 … … 1324 1331 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1325 1332 */ 1326 1333 function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { 1327 adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);1334 echo get_next_post_link( $format, $link, $in_same_cat, $excluded_categories ); 1328 1335 } 1329 1336 1330 1337 /** 1338 * needs-docs if accepted... 1339 */ 1340 function get_next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { 1341 return adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, false, true ); 1342 } 1343 1344 /** 1331 1345 * Display adjacent post link. 1332 1346 * 1333 1347 * Can be either next post link or previous. … … 1339 1353 * @param bool $in_same_cat Optional. Whether link should be in a same category. 1340 1354 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs. 1341 1355 * @param bool $previous Optional, default is true. Whether to display link to previous or next post. 1356 * @param bool $return Optional, default is false. Whether to return the link or echo it. 1342 1357 */ 1343 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) {1358 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true, $return = false) { 1344 1359 if ( $previous && is_attachment() ) 1345 1360 $post = & get_post($GLOBALS['post']->post_parent); 1346 1361 else … … 1366 1381 $format = str_replace('%link', $link, $format); 1367 1382 1368 1383 $adjacent = $previous ? 'previous' : 'next'; 1369 echo apply_filters( "{$adjacent}_post_link", $format, $link ); 1384 1385 if ( $return ) 1386 return apply_filters( "{$adjacent}_post_link", $format, $link ); 1387 else 1388 echo apply_filters( "{$adjacent}_post_link", $format, $link ); 1370 1389 } 1371 1390 1372 1391 /**