Page comments from the first page of a multi-page post. Props Viper007Bond. fixes #8450

git-svn-id: http://svn.automattic.com/wordpress/trunk@10039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-12-04 19:11:53 +00:00
parent fd5a7d8a18
commit 87141a219f
1 changed files with 2 additions and 14 deletions

View File

@ -1214,23 +1214,11 @@ function posts_nav_link( $sep = ' — ', $prelabel = '« Previous Page'
* @return string * @return string
*/ */
function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
global $wp_rewrite; global $post, $wp_rewrite;
$pagenum = (int) $pagenum; $pagenum = (int) $pagenum;
$request = remove_query_arg( 'cpage' ); $result = get_permalink( $post->ID );
$home_root = parse_url(get_option('home'));
$home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
$home_root = preg_quote( trailingslashit( $home_root ), '|' );
$request = preg_replace('|^'. $home_root . '|', '', $request);
$request = preg_replace('|^/+|', '', $request);
$request = preg_replace('|comment-page-[0-9]+/?$|', '', $request);
$base = trailingslashit( get_bloginfo( 'home' ) );
$result = user_trailingslashit($base . $request);
if ( 'newest' == get_option('default_comments_page') ) { if ( 'newest' == get_option('default_comments_page') ) {
if ( $pagenum != $max_page ) { if ( $pagenum != $max_page ) {