Ticket #13489: 13489.patch
File 13489.patch, 2.8 KB (added by , 13 years ago) |
---|
-
wp-includes/link-template.php
1438 1438 * @param string $excluded_categories Optional. Excluded categories IDs. 1439 1439 * @param bool $previous Optional, default is true. Whether display link to previous post. 1440 1440 */ 1441 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { 1441 function adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) { 1442 echo get_adjacent_post_link( $format, $link, $in_same_cat, $excluded_categories, $previous ); 1443 } 1444 1445 /** 1446 * Display adjacent post link. 1447 * 1448 * Can be either next post link or previous. 1449 * 1450 * @since 3.2 1451 * 1452 * @param string $format Link anchor format. 1453 * @param string $link Link permalink format. 1454 * @param bool $in_same_cat Optional. Whether link should be in same category. 1455 * @param string $excluded_categories Optional. Excluded categories IDs. 1456 * @param bool $previous Optional, default is true. Whether display link to previous post. 1457 */ 1458 function get_adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) { 1442 1459 if ( $previous && is_attachment() ) 1443 $post = & get_post( $GLOBALS['post']->post_parent);1460 $post = & get_post( $GLOBALS['post']->post_parent ); 1444 1461 else 1445 $post = get_adjacent_post( $in_same_cat, $excluded_categories, $previous);1462 $post = get_adjacent_post( $in_same_cat, $excluded_categories, $previous ); 1446 1463 1447 if ( ! $post )1464 if ( ! $post ) 1448 1465 return; 1449 1466 1450 1467 $title = $post->post_title; 1451 1468 1452 if ( empty( $post->post_title) )1453 $title = $previous ? __( 'Previous Post') : __('Next Post');1469 if ( empty( $post->post_title ) ) 1470 $title = $previous ? __( 'Previous Post' ) : __( 'Next Post' ); 1454 1471 1455 $title = apply_filters( 'the_title', $title, $post->ID);1456 $date = mysql2date( get_option('date_format'), $post->post_date);1472 $title = apply_filters( 'the_title', $title, $post->ID ); 1473 $date = mysql2date( get_option( 'date_format' ), $post->post_date ); 1457 1474 $rel = $previous ? 'prev' : 'next'; 1458 1475 1459 $string = '<a href="' .get_permalink($post).'" rel="'.$rel.'">';1460 $link = str_replace( '%title', $title, $link);1461 $link = str_replace( '%date', $date, $link);1476 $string = '<a href="' . get_permalink( $post ) . '" rel="' . $rel . '">'; 1477 $link = str_replace( '%title', $title, $link ); 1478 $link = str_replace( '%date', $date, $link ); 1462 1479 $link = $string . $link . '</a>'; 1463 1480 1464 $format = str_replace( '%link', $link, $format);1481 $format = str_replace( '%link', $link, $format ); 1465 1482 1466 1483 $adjacent = $previous ? 'previous' : 'next'; 1467 echoapply_filters( "{$adjacent}_post_link", $format, $link );1484 return apply_filters( "{$adjacent}_post_link", $format, $link ); 1468 1485 } 1469 1486 1470 1487 /**