Some docs and corrections to _wp_link_page().

git-svn-id: http://svn.automattic.com/wordpress/trunk@15617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-09-14 16:48:38 +00:00
parent 3ad167f45d
commit 2671e9cc72
1 changed files with 11 additions and 2 deletions

View File

@ -616,18 +616,27 @@ function wp_link_pages($args = '') {
return $output; return $output;
} }
/**
* Helper function for wp_link_pages().
*
* @since 3.1.0
* @access private
*
* @param $i Page number.
* @return string Link.
*/
function _wp_link_page( $i ) { function _wp_link_page( $i ) {
global $post, $wp_rewrite; global $post, $wp_rewrite;
if ( 1 == $i ) { if ( 1 == $i ) {
$url .= get_permalink(); $url = get_permalink();
} else { } else {
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$url = add_query_arg( 'page', $i, get_permalink() ); $url = add_query_arg( 'page', $i, get_permalink() );
elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged'); $url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
else else
$url .= trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged'); $url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
} }
return '<a href="' . $url . '">'; return '<a href="' . $url . '">';