Changeset 23653
- Timestamp:
- 03/08/2013 06:33:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r23639 r23653 603 603 * 604 604 * The defaults for overwriting are: 605 * 'next_or_number' - Default is 'number' (string). Indicates whether page606 * numbers should be used. Valid values are number and next.607 * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page.608 * of the bookmark.609 * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to610 * previous page, if available.611 * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in612 * the parameter string will be replaced with the page number, so Page %613 * generates "Page 1", "Page 2", etc. Defaults to %, just the page number.614 605 * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to 615 606 * each bookmarks. … … 622 613 * Pages link inside the <a> tag. Also appended to the current item, which 623 614 * is not linked. 615 * 'next_or_number' - Default is 'number' (string). Indicates whether page 616 * numbers should be used. Valid values are number and next. 617 * 'separator' - Default is ' ' (string). Text used between pagination links. 618 * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page. 619 * of the bookmark. 620 * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to 621 * previous page, if available. 622 * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in 623 * the parameter string will be replaced with the page number, so Page % 624 * generates "Page 1", "Page 2", etc. Defaults to %, just the page number. 625 * 'echo' - Default is 1 (integer). When not 0, this triggers the HTML to be 626 * echoed and then returned. 624 627 * 625 628 * @since 1.2.0 626 * @access private627 629 * 628 630 * @param string|array $args Optional. Overwrite the defaults. 629 631 * @return string Formatted output in HTML. 630 632 */ 631 function wp_link_pages( $args = '') {633 function wp_link_pages( $args = '' ) { 632 634 $defaults = array( 633 'before' => '<p>' . __('Pages:'), 'after' => '</p>', 634 'link_before' => '', 'link_after' => '', 635 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), 636 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 637 'echo' => 1 635 'before' => '<p>' . __( 'Pages:' ), 636 'after' => '</p>', 637 'link_before' => '', 638 'link_after' => '', 639 'next_or_number' => 'number', 640 'separator' => ' ', 641 'nextpagelink' => __( 'Next page' ), 642 'previouspagelink' => __( 'Previous page' ), 643 'pagelink' => '%', 644 'echo' => 1 638 645 ); 639 646 … … 648 655 if ( 'number' == $next_or_number ) { 649 656 $output .= $before; 650 for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { 651 $j = str_replace('%',$i,$pagelink); 652 $output .= ' '; 653 if ( ($i != $page) || ((!$more) && ($page==1)) ) { 654 $output .= _wp_link_page($i); 655 } 656 $output .= $link_before . $j . $link_after; 657 if ( ($i != $page) || ((!$more) && ($page==1)) ) 658 $output .= '</a>'; 657 for ( $i = 1; $i <= $numpages; $i++ ) { 658 $link = $link_before . str_replace( '%', $i, $pagelink ) . $link_after; 659 if ( $i != $page || ! $more && 1 == $page ) 660 $link = _wp_link_page( $i ) . $link . '</a>'; 661 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 662 $output .= $separator . $link; 659 663 } 660 664 $output .= $after; 661 } else { 662 if ( $more ) { 663 $output .= $before; 664 $i = $page - 1; 665 if ( $i && $more ) { 666 $output .= _wp_link_page($i); 667 $output .= $link_before. $previouspagelink . $link_after . '</a>'; 668 } 669 $i = $page + 1; 670 if ( $i <= $numpages && $more ) { 671 $output .= _wp_link_page($i); 672 $output .= $link_before. $nextpagelink . $link_after . '</a>'; 673 } 674 $output .= $after; 665 } elseif ( $more ) { 666 $output .= $before; 667 $i = $page - 1; 668 if ( $i ) { 669 $link = _wp_link_page( $i ) . $link_before . $previouspagelink . $link_after . '</a>'; 670 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 671 $output .= $separator . $link; 675 672 } 673 $i = $page + 1; 674 if ( $i <= $numpages ) { 675 $link = _wp_link_page( $i ) . $link_before . $nextpagelink . $link_after . '</a>'; 676 $link = apply_filters( 'wp_link_pages_link', $link, $i ); 677 $output .= $separator . $link; 678 } 679 $output .= $after; 676 680 } 677 681 } 682 683 $output = apply_filters( 'wp_link_pages', $output, $args ); 678 684 679 685 if ( $echo )
Note: See TracChangeset
for help on using the changeset viewer.