Apply $numpages to comment-page link
-
I have comments on a standard post as normal and only on the last page of a paginated post ( <!–nextpage–> ). I managed to change the permalink of comments_link on index, home, archive, search to include $numpages in the URL, but I can’t figure out how to do the same for next/previous_comments_link so that it says, for example, …post/3/comment-page-2/#comments
I used the following for comments_link…
function pf_comments_link( $permalink, $post_id ) { global $multipage, $numpages; if ( $multipage ) { $pfCommentURL = get_permalink(); $pfCommentLinkAnchor = '/#comments'; $pfCommentLink = $pfCommentURL.$numpages.$pfCommentLinkAnchor;} else { $pfCommentURL = get_permalink(); $pfCommentLinkAnchor = '#comments'; $pfCommentLink = $pfCommentURL.$pfCommentLinkAnchor;} return $pfCommentLink; } add_filter( 'get_comments_link', 'pf_comments_link', 10, 2 );
- The topic ‘Apply $numpages to comment-page link’ is closed to new replies.