Ticket #10558: wp_link_pages-both.diff
File wp_link_pages-both.diff, 4.4 KB (added by , 15 years ago) |
---|
-
Users/simon/Projects/StephenFry/site/wordpress/wp-includes/post-template.php
533 533 * 534 534 * The defaults for overwriting are: 535 535 * 'next_or_number' - Default is 'number' (string). Indicates whether page 536 * numbers should be used. Valid values are number and next. 536 * numbers should be used. Valid values are number, next or both (uses 537 * page numbers and a next prev link). 537 538 * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page. 538 539 * of the bookmark. 539 540 * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to … … 578 579 579 580 $output = ''; 580 581 if ( $multipage ) { 581 if ( 'number' == $next_or_number) {582 if ( $more ) { 582 583 $output .= $before; 583 for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { 584 $j = str_replace('%',"$i",$pagelink); 585 $output .= ' '; 586 if ( ($i != $page) || ((!$more) && ($page==1)) ) { 587 if ( 1 == $i ) { 588 $output .= '<a href="' . get_permalink() . '">'; 589 } else { 590 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 591 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'; 592 else 593 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 594 } 595 596 } 597 $output .= $link_before; 598 $output .= $j; 599 $output .= $link_after; 600 if ( ($i != $page) || ((!$more) && ($page==1)) ) 601 $output .= '</a>'; 602 } 603 $output .= $after; 604 } else { 605 if ( $more ) { 606 $output .= $before; 584 if ( 'both' == $next_or_number ) { 607 585 $i = $page - 1; 608 586 if ( $i && $more ) { 609 587 if ( 1 == $i ) { … … 612 590 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 613 591 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>'; 614 592 else 615 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a> ';593 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a> '; 616 594 } 617 595 } 596 } 597 if ( 'number' == $next_or_number || 'both' == $next_or_number ) { 598 for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { 599 $j = str_replace('%',"$i",$pagelink); 600 $output .= ' '; 601 if ( ($i != $page) || ((!$more) && ($page==1)) ) { 602 if ( 1 == $i ) { 603 $output .= '<a href="' . get_permalink() . '">'; 604 } else { 605 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 606 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'; 607 else 608 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 609 } 610 611 } 612 $output .= $link_before; 613 $output .= $j; 614 $output .= $link_after; 615 if ( ($i != $page) || ((!$more) && ($page==1)) ) 616 $output .= '</a> '; 617 } 618 } 619 if ( 'both' == $next_or_number ) { 618 620 $i = $page + 1; 619 if ( $i <= $numpages && $more) {621 if ( $i <= $numpages ) { 620 622 if ( 1 == $i ) { 621 623 $output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>'; 622 624 } else { 623 625 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 624 626 $output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>'; 625 627 else 626 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a> ';628 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a> '; 627 629 } 628 630 } 629 $output .= $after;630 631 } 632 $output .= $after; 631 633 } 634 632 635 } 636 637 $output = apply_filters( 'wp_link_pages', $output, $r ); 633 638 634 639 if ( $echo ) 635 640 echo $output;