WordPress.org

Make WordPress Core

Ticket #10667: search-pagination-2.diff

File search-pagination-2.diff, 3.0 KB (added by andy, 8 years ago)
  • wp-content/themes/twentyten/loop.php

     
    11<?php if ( $wp_query->max_num_pages > 1 ) { ?>
    22        <div id="nav-above" class="navigation">
     3<?php if ( is_search() ) { ?>
     4                <div class="nav-previous"><?php previous_posts_link(__( '<span class="meta-nav">&larr;</span> Previous results', 'twentyten' )) ?></div>
     5                <div class="nav-next"><?php next_posts_link(__( 'Next results <span class="meta-nav">&rarr;</span>', 'twentyten' )) ?></div>
     6<?php } else { ?>
    37                <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' )); ?></div>
    48                <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' )); ?></div>
     9<?php } ?>
    510        </div><!-- #nav-above -->
    611<?php } ?>
    712
     
    110115<?php endwhile; ?>
    111116
    112117<?php if (  $wp_query->max_num_pages > 1 ) { ?>
    113                                 <div id="nav-below" class="navigation">
    114                                         <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' )); ?></div>
    115                                         <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' )); ?></div>
    116                                 </div><!-- #nav-below -->
     118        <div id="nav-below" class="navigation">
     119<?php if ( is_search() ) { ?>
     120                <div class="nav-previous"><?php previous_posts_link(__( '<span class="meta-nav">&larr;</span> Previous results', 'twentyten' )) ?></div>
     121                <div class="nav-next"><?php next_posts_link(__( 'Next results <span class="meta-nav">&rarr;</span>', 'twentyten' )) ?></div>
     122<?php } else { ?>
     123                <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' )); ?></div>
     124                <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' )); ?></div>
     125<?php } ?>
     126        </div><!-- #nav-below -->
    117127<?php } ?>
     128 No newline at end of file
  • wp-includes/link-template.php

     
    14081408        $nextpage = intval($paged) + 1;
    14091409
    14101410        if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
     1411                $label = apply_filters( 'next_posts_link_label', $label );
    14111412                $attr = apply_filters( 'next_posts_link_attributes', '' );
    14121413                return '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
    14131414        }
     
    14761477        global $paged;
    14771478
    14781479        if ( !is_single() && $paged > 1 ) {
     1480                $label = apply_filters( 'previous_posts_link_label', $label );
    14791481                $attr = apply_filters( 'previous_posts_link_attributes', '' );
    14801482                return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label ) .'</a>';
    14811483        }