comment-template.php Help
-
just wondering why there is ‘li-comment-<?php comment_ID(); ?>’ in your functions.php in the first place;
instead of changing it, you might be able to add ‘comment-<?php comment_ID(); ?>’
(details depend on the exact code of this area – if you like you can paste the code of your functions.php into a http://wordpress.pastebin.com/ and post the link to it here)
if you are working with a free theme, you can post the name and dwonload link of this theme here as well.
Thanks for your reply.
I’m using the Starkers theme: http://starkerstheme.com/
The code for the comments is in functions.php. The comments function is as follows:
if ( ! function_exists( 'twentyten_comment' ) ) : function twentyten_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php echo get_avatar( $comment, 40 ); ?> <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> </div><!-- .comment-author .vcard --> <?php if ( $comment->comment_approved == '0' ) : ?> <em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em> <br /> <?php endif; ?> <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> <?php /* translators: 1: date, 2: time */ printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?> </div><!-- .comment-meta .commentmetadata --> <div class="comment-body"><?php comment_text(); ?></div> <div class="reply"> <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> </div><!-- .reply --> </div><!-- #comment-## --> <?php break; case 'pingback' : case 'trackback' : ?> <li class="post pingback"> <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'twentyten'), ' ' ); ?></p> <?php break; endswitch; } endif;You can see that the first two lines of the html are an li with id=”li-comment-<?php comment_ID(); and a div with id=”comment-<?php comment_ID(); ?>”.
This all works correctly, apart from when you click reply to a particular post… the form header doesn’t change to ‘Leave a Reply to [correct username]’.
Curiously, if I change the id of the div to “li-comment-<?php comment_ID(); ?>” it does change the form header appropriately. But then the form isn’t moved up to the correct comment!
Bump!
The topic ‘comment-template.php Help’ is closed to new replies.
(@ste9890)
15 years, 2 months ago
Not sure if this is in the right section but here goes:
In the comments on my blog, when I click ‘reply’ to a post the page refreshes with the query string in the address bar (?replytocom=24#respond) and it doesn’t move the comment form up to the right place – it just stays at the bottom. However the form h3 does change to ‘Leave a Reply to [correct username]’.
In my functions.php, if I change the id of the comment li from ‘li-comment-<?php comment_ID(); ?>’ to just ‘comment-<?php comment_ID(); ?>’ it then solves the problem. BUT this then means the comment form h3 doesnt change to ‘Leave a Reply to [correct username]’, it just stays as ‘Leave a Reply’.
I hope that makes sense!
Can anyone help me? Thanks!