Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#31298 closed enhancement (fixed)

"comment-reply-login" class missing from get_post_reply_link()

Reported by: johnjamesjacoby Owned by: SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch 2nd-opinion
Focuses: template Cc:

Description

In #8633 and r11060 get_comment_reply_link() received a class on the link that's put out when a user is prompted to login to comment, but get_post_reply_link() did not.

Patch imminent.

Attachments (1)

31298.01.patch (424 bytes) - added by johnjamesjacoby 7 years ago.

Download all attachments as: .zip

Change History (3)

#1 @johnjamesjacoby
7 years ago

For context, the obvious use-case for a link like this is custom styling in a theme.

The less obvious one is the ability to filter post_comments_link and target that class specifically to modify it separately from comment-reply-link.

One example for Bootstrap to add btn classes would be:

function bs_comment_reply_link( $link = '' ) {
	$link = str_replace( 'comment-reply-login', 'comment-reply-login btn btn-sm btn-default', $link );
	$link = str_replace( 'comment-reply-link',  'comment-reply-link btn btn-sm btn-default',  $link );
	return $link;
}
add_filter( 'comment_reply_link', 'bs_comment_reply_link' );

Right now, the same code cannot be applied to post_comments_link as the comment-reply-login class does not exist. My above patch brings both functions inline with each other.

#2 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 31412:

Add .comment-reply-login class to get_post_reply_link(), for consistency with get_comment_reply_link().

props johnjamesjacoby.
fixes #31298.

Note: See TracTickets for help on using tickets.