Site logo

Archived topic

Reply link at the bottom of the comments

9 replies · Started by dmmaso on August 13, 2019

Viewing posts 1–10 of 10

Hi there,

Right now this is difficult, as there are no hooks in that area.

I've just committed a change for GP 2.4, which introduces a hook there: https://github.com/tomusborne/generatepress/blob/release/2.4/inc/structure/comments.php#L84-L90

With that hook, you'll be able to do this:

add_action( 'generate_after_comment_text', function( $comment, $args, $depth ) {
	comment_reply_link( array_merge( $args, array(
		'add_below' => 'div-comment',
		'depth'     => $depth,
		'max_depth' => $args['max_depth'],
		'before'    => '<span class="reply">',
		'after'     => '</span>',
	) ) );
}, 10, 3 );

If you'd like, you can add that hook to your current version and begin using the above code right away :)

Hi Tom,

Exactly where did I put the code now in the functions.php file?

Thanks for your help.

So first you will need to copy the comment.php file Tom linked above and add it in your child theme.

Then you can add the code provided in your child theme's function.php file (it's empty by default).

Let me know :)

Hi there,

Since we're implementing this hook by default, there's no need to copy the file into your child theme.

Instead, you can just edit the core file in inc/structure/comments.php and add the hook in there.

To make it easier, just copy the entire contents of the file (https://raw.githubusercontent.com/tomusborne/generatepress/release/2.4/inc/structure/comments.php) and replace the contents of your current file.

Then you can use the hook I provided above :)

Hi,

Sorry for my ignorance, but I still don't see how to solve this.

I tried to do what you told me but I didn't quite understand.

Sorry for the inconvenience

Great! Thanks for the patience! :)

Glad we could be of help

This archived topic is closed to new replies.