Set the $comment
global in comment_form_title()
.
In [33963], `comment_form_title()` was refactored so that it no longer made reference to the `$comment` global. This broke some functionality within the comment form, as certain template would no longer be able to access the "current" comment. Props d4z_c0nf, WisdmLabs, boonebgorges. Fixes #35624. git-svn-id: https://develop.svn.wordpress.org/trunk@36512 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0ae22e5f4c
commit
126193fa3c
@ -1817,7 +1817,7 @@ function comment_id_fields( $id = 0 ) {
|
|||||||
* to their comment. Default true.
|
* to their comment. Default true.
|
||||||
*/
|
*/
|
||||||
function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
|
function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
|
||||||
$comment = get_comment();
|
global $comment;
|
||||||
|
|
||||||
if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
|
if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
|
||||||
if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );
|
if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );
|
||||||
@ -1827,6 +1827,7 @@ function comment_form_title( $noreplytext = false, $replytext = false, $linktopa
|
|||||||
if ( 0 == $replytoid )
|
if ( 0 == $replytoid )
|
||||||
echo $noreplytext;
|
echo $noreplytext;
|
||||||
else {
|
else {
|
||||||
|
// Sets the global so that template tags can be used in the comment form.
|
||||||
$comment = get_comment($replytoid);
|
$comment = get_comment($replytoid);
|
||||||
$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
|
$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
|
||||||
printf( $replytext, $author );
|
printf( $replytext, $author );
|
||||||
|
Loading…
Reference in New Issue
Block a user