In `wp_link_pages()`, only output link separators between actual pagination links. Fixes #24940. Props obenland.

git-svn-id: https://develop.svn.wordpress.org/trunk@30030 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2014-10-26 22:40:07 +00:00
parent 42773dc11b
commit b92307f58d
1 changed files with 9 additions and 5 deletions

View File

@ -787,7 +787,10 @@ function wp_link_pages( $args = '' ) {
* @param int $i Page number for paginated posts' page links.
*/
$link = apply_filters( 'wp_link_pages_link', $link, $i );
$output .= $r['separator'] . $link;
// Use the custom links separator beginning with the second link.
$output .= ( 1 === $i ) ? ' ' : $r['separator'];
$output .= $link;
}
$output .= $r['after'];
} elseif ( $more ) {
@ -797,16 +800,17 @@ function wp_link_pages( $args = '' ) {
$link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
/** This filter is documented in wp-includes/post-template.php */
$link = apply_filters( 'wp_link_pages_link', $link, $prev );
$output .= $r['separator'] . $link;
$output .= apply_filters( 'wp_link_pages_link', $link, $prev );
}
$next = $page + 1;
if ( $next <= $numpages ) {
if ( $prev ) {
$output .= $r['separator'];
}
$link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
/** This filter is documented in wp-includes/post-template.php */
$link = apply_filters( 'wp_link_pages_link', $link, $next );
$output .= $r['separator'] . $link;
$output .= apply_filters( 'wp_link_pages_link', $link, $next );
}
$output .= $r['after'];
}