Link to comments at bottom of page

I'd like to have a link to any existing comments, or to the add comment form, at the bottom of pages on the main page, category and tag archives, etc. I don't want people to have to scroll back up once they've decided if they want to comment.

Can this be done? I saw that I could insert a WP template tag in the loop-common template, but then it appears on individual pages too and I don't know how to stop it.

Thanks.

Hello, The functionality you are asking for is already present in rtPanel. You can see comment count beside post title , which gives link to the comment form on individual page. If you don't want to display number in comment count link you can modify the function accordingly as follows.

Step 1: add the line :

remove_action( 'rtp_hook_end_post_title', 'rtp_default_comment_count' );  

in function named "rtp_remove_parent_hooks" present in rtp-custom-hooks-applied.php file in lib folder.

Step 2: Add following function to the same file.

<?php  
function rtp_new_comment_link() {   
    global $rtp_post_comments; // Comment Count  
    if ( ( ( get_comments_number() || @comments_open() ) && !is_attachment() && !rtp_is_bbPress() ) || ( is_attachment() &&  $rtp_post_comments['attachment_comments'] ) ) {  
    // If post meta is set to top then only display the comment count.   
    ?>  
    

{ <?php comments_popup_link( _x( 'Comments', 'comments number', 'rtPanel' ), _x( 'Comments', 'comments number', 'rtPanel' ), _x( 'Comments', 'comments number', 'rtPanel' ), 'rtp-post-comment rtp-common-link' ); ?> }

<?php } } add_action( 'rtp_hook_end_post_title', 'rtp_new_comment_link' ); ?>

Hope this will fulfill your requirement. Let us know if you are expecting something else and also provide us the url for better assistance.

Regards.

Thank you, but that wasn't quite what I wanted.

Here is the page I'm working on .

First, I didn't have an existing function named “rtp_remove_parent_hooks” , and I must be misplacing brackets or something, because when I try to add it, I keep getting errors. (I don't actually know PHP in any useful way.) So I've left it out for now.

Second, I don't want to remove the number of comments. The existing comments link of "X comments" is fine. I do want that at the bottom of the post, not the top.

I took your second piece of code and changed it to

add_action( 'rtp_hook_end_post_content, 'rtp_new_comment_link' );

which works to put the comment link at the bottom, but then I lose the comments number. And it also still shows the comments link on individual post pages too, where it's not necessary because the "X Comments… Share your views" is right underneath it. So obviously my first guess at how to fix this is wrong.

So I'd like to please know how I can get the existing comment link and its existing behavior to the end of the post. Thanks.

Oh, and when the "X comments" is added to the bottom of the post, I'd like it to be

class="alignleft rtp-post-comment-count"

rather than "alignright."

Thanks again.

Hello, I understood your requirement. In order to achive this please follow the below mentioned steps. Step 1: Add this code to your functions.php file at bottom. function rtp_remove_existing_hook(){ remove_action( 'rtp_hook_end_post_title', 'rtp_default_comment_count' ); } add_action( 'init', 'rtp_remove_existing_hook', 12 );

Step 2: Add this code to your functions.php below abovementioned code function rtp_default_comment_count_custom() { if( is_single() ) return; // do not show on single page. global $rtp_post_comments; // Comment Count add_filter( 'get_comments_number', 'rtp_only_comment_count', 11, 2 ); if ( ( ( get_comments_number() || @comments_open() ) && !is_attachment() && !rtp_is_bbPress() ) || ( is_attachment() && $rtp_post_comments['attachment_comments'] ) ) { // If post meta is set to top then only display the comment count. ?>

{<?php comments_popup_link( _x( '0 Comments', 'comments number', 'rtPanel' ), _x( '1 Comment', 'comments number', 'rtPanel' ), _x( '% Comments', 'comments number', 'rtPanel' ), 'rtp-post-comment rtp-common-link' ); ?>}

<?php } remove_filter( 'get_comments_number', 'rtp_only_comment_count', 11, 2 ); } add_action( 'rtp_hook_end_post_content', 'rtp_default_comment_count_custom' ); Step 3:   Add following lines to style.css file at bottom.

.rtp-post-comment-count { clear: both; }

I hope above solution will solve your problem , let me know if anything else desired.

NOTE:  Please Copy and paste the code carefully

Regards. Ankit

That worked, thanks, though I had to take the curly single quotes out of the first function!

Hello, Simply rewrite the function rtp_default_comment_count_custom which I mentioned in previous solution as below.

function rtp_default_comment_count_custom() { if( is_single() ) return; // do not show on single page. global $rtp_post_comments; // Comment Count add_filter( 'get_comments_number', 'rtp_only_comment_count', 11, 2 ); if ( ( ( get_comments_number() || @comments_open() ) && !is_attachment() && !rtp_is_bbPress() ) || ( is_attachment() && $rtp_post_comments['attachment_comments'] ) ) { // If post meta is set to top then only display the comment count. ?>

<?php comments_popup_link( _x( '0 Comments', 'comments number', 'rtPanel' ), _x( '1 Comment', 'comments number', 'rtPanel' ), _x( '% Comments', 'comments number', 'rtPanel' ), 'rtp-post-comment rtp-common-link' ); ?>

<?php } remove_filter( 'get_comments_number', 'rtp_only_comment_count', 11, 2 ); } add_action( 'rtp_hook_end_post_content', 'rtp_default_comment_count_custom' );

Regards. Ankit