Archived topic
Reply link at the bottom of the comments
9 replies · Started by dmmaso on August 13, 2019
Hi,
I would like to put the reply link of the comments at the bottom of the comment. It's possible?
Attached capture
https://drive.google.com/file/d/1Wk10l7VZ3lNsnLAwDE4qbSFj-5_eZlNU/view?usp=sharing
Thanks in advance
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 Leo,
I have copied the comments.php and added the code to the functions file but the design changes completely and the comments disappear.
Link: https://nergiza.pilvia.site/magnetotermico-diferencial-e-icp-no-todos-los-machetes-son-iguales/
Thanks
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
Hi there,
edit the file here inc/structure/comments.php - either by using the Appearance > Theme Editor or accessing that file via FTP in the Themes/GeneratePress folder.
Once you in the file delete its entire content and replace it with the code that Tom provided here:
https://raw.githubusercontent.com/tomusborne/generatepress/release/2.4/inc/structure/comments.php
Great! Thanks for the patience! :)
Glad we could be of help