Make WordPress Core

Ticket #6109: link-template.patch

File link-template.patch, 2.4 KB (added by sorich87, 15 years ago)

here is a patch

  • wp-includes/link-template.php

     
    14801480 * @param int $max_page Optional. Max pages.
    14811481 * @return string|null
    14821482 */
    1483 function get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) {
     1483function get_next_posts_link( $label = 'Next Page »', $max_page = 0, $class='' ) {
    14841484        global $paged, $wp_query;
    14851485
    14861486        if ( !$max_page )
     
    14921492        $nextpage = intval($paged) + 1;
    14931493
    14941494        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 );
    14961499                return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
    14971500        }
    14981501}
     
    15061509 * @param string $label Content for link text.
    15071510 * @param int $max_page Optional. Max pages.
    15081511 */
    1509 function next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
    1510         echo get_next_posts_link( $label, $max_page );
     1512function next_posts_link( $label = 'Next Page &raquo;', $max_page = 0, $class='' ) {
     1513        echo get_next_posts_link( $label, $max_page, $class );
    15111514}
    15121515
    15131516/**
     
    15561559 * @param string $label Optional. Previous page link text.
    15571560 * @return string|null
    15581561 */
    1559 function get_previous_posts_link( $label = '&laquo; Previous Page' ) {
     1562function get_previous_posts_link( $label = '&laquo; Previous Page', $class='' ) {
    15601563        global $paged;
    15611564
    15621565        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 );
    15641570                return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label ) .'</a>';
    15651571        }
    15661572}
     
    15731579 *
    15741580 * @param string $label Optional. Previous page link text.
    15751581 */
    1576 function previous_posts_link( $label = '&laquo; Previous Page' ) {
    1577         echo get_previous_posts_link( $label );
     1582function previous_posts_link( $label = '&laquo; Previous Page', $class='' ) {
     1583        echo get_previous_posts_link( $label, $class );
    15781584}
    15791585
    15801586/**