Ticket #6109: link-template.patch
File link-template.patch, 2.4 KB (added by , 15 years ago) |
---|
-
wp-includes/link-template.php
1480 1480 * @param int $max_page Optional. Max pages. 1481 1481 * @return string|null 1482 1482 */ 1483 function get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) {1483 function get_next_posts_link( $label = 'Next Page »', $max_page = 0, $class='' ) { 1484 1484 global $paged, $wp_query; 1485 1485 1486 1486 if ( !$max_page ) … … 1492 1492 $nextpage = intval($paged) + 1; 1493 1493 1494 1494 if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) { 1495 $attr = apply_filters( 'next_posts_link_attributes', '' ); 1495 $attr = ''; 1496 if ( !empty($class) ) 1497 $attr = 'class="'. $class . '"'; 1498 $attr = apply_filters( 'next_posts_link_attributes', $attr ); 1496 1499 return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $label) . '</a>'; 1497 1500 } 1498 1501 } … … 1506 1509 * @param string $label Content for link text. 1507 1510 * @param int $max_page Optional. Max pages. 1508 1511 */ 1509 function next_posts_link( $label = 'Next Page »', $max_page = 0 ) {1510 echo get_next_posts_link( $label, $max_page );1512 function next_posts_link( $label = 'Next Page »', $max_page = 0, $class='' ) { 1513 echo get_next_posts_link( $label, $max_page, $class ); 1511 1514 } 1512 1515 1513 1516 /** … … 1556 1559 * @param string $label Optional. Previous page link text. 1557 1560 * @return string|null 1558 1561 */ 1559 function get_previous_posts_link( $label = '« Previous Page' ) {1562 function get_previous_posts_link( $label = '« Previous Page', $class='' ) { 1560 1563 global $paged; 1561 1564 1562 1565 if ( !is_single() && $paged > 1 ) { 1563 $attr = apply_filters( 'previous_posts_link_attributes', '' ); 1566 $attr = ''; 1567 if ( !empty($class) ) 1568 $attr = 'class="'. $class . '"'; 1569 $attr = apply_filters( 'previous_posts_link_attributes', $attr ); 1564 1570 return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', $label ) .'</a>'; 1565 1571 } 1566 1572 } … … 1573 1579 * 1574 1580 * @param string $label Optional. Previous page link text. 1575 1581 */ 1576 function previous_posts_link( $label = '« Previous Page' ) {1577 echo get_previous_posts_link( $label );1582 function previous_posts_link( $label = '« Previous Page', $class='' ) { 1583 echo get_previous_posts_link( $label, $class ); 1578 1584 } 1579 1585 1580 1586 /**