Changeset 23804 for trunk/wp-includes/query.php
- Timestamp:
- 03/27/2013 08:31:12 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r23554 r23804 3622 3622 endif; 3623 3623 } 3624 /** 3625 * Split the passed content by <!--nextpage--> 3626 * 3627 * @since 3.6.0 3628 * 3629 * @param string $content Content to split 3630 * @return array Paged content 3631 */ 3632 function paginate_content( $content ) { 3633 $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); 3634 $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); 3635 $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); 3636 return explode( '<!--nextpage-->', $content); 3637 } 3638 3639 /** 3640 * Return content offset by $page 3641 * 3642 * @since 3.6.0 3643 * 3644 * @param string $content 3645 * @return string 3646 */ 3647 function get_paged_content( $content = null, $paged = null ) { 3648 global $page; 3649 if ( empty( $page ) ) 3650 $page = 1; 3651 3652 if ( empty( $paged ) ) 3653 $paged = $page; 3654 3655 if ( empty( $content ) ) { 3656 $post = get_post(); 3657 if ( empty( $post ) ) 3658 return; 3659 3660 $content = $post->post_content; 3661 } 3662 3663 $pages = paginate_content( $content ); 3664 if ( isset( $pages[$paged - 1] ) ) 3665 return $pages[$paged - 1]; 3666 3667 return reset( $pages ); 3668 } 3624 3669 3625 3670 /**
Note: See TracChangeset
for help on using the changeset viewer.