Re-use /page/xx/ for Post Paging on Page_on_front. Few fixes related to paging on front page. Fixes #12391

git-svn-id: http://svn.automattic.com/wordpress/trunk@13494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-02-28 09:40:42 +00:00
parent 479926f048
commit 70e4a7d880
2 changed files with 23 additions and 8 deletions

View File

@ -587,7 +587,9 @@ function wp_link_pages($args = '') {
$output .= '<a href="' . get_permalink() . '">';
} else {
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
$output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
else
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
}
@ -606,24 +608,30 @@ function wp_link_pages($args = '') {
$i = $page - 1;
if ( $i && $more ) {
if ( 1 == $i ) {
$output .= '<a href="' . get_permalink() . '">' . $link_before. $previouspagelink . $link_after . '</a>';
$output .= '<a href="' . get_permalink() . '">';
} else {
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>';
$output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
else
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
}
$output .= $link_before. $previouspagelink . $link_after . '</a>';
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
if ( 1 == $i ) {
$output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>';
$output .= '<a href="' . get_permalink() . '">';
} else {
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>';
$output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
else
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
}
$output .= $link_before. $nextpagelink . $link_after . '</a>';
}
$output .= $after;
}

View File

@ -1480,11 +1480,18 @@ class WP_Query {
(
empty($this->query) ||
!empty($qv['preview']) ||
!empty($qv['cpage'])
!empty($qv['cpage']) ||
!empty($qv['page']) ||
!empty($qv['paged'])
) ) {
$this->is_page = true;
$this->is_home = false;
$qv['page_id'] = get_option('page_on_front');
// Correct <!--nextpage--> for page_on_front
if ( !empty($qv['paged']) ) {
$qv['page'] = $qv['paged'];
unset($qv['paged']);
}
}
if ( '' != $qv['pagename'] ) {