“Comment Comments For This Post”
-
Hey everyone, I’m having a problem that has me stumped. When you go to view comments on my site, everything works as it should, but where it shows how many comments have been posted, it shows “Comment Comments For This Post”. I’m assuming it’s a problem with it knowing whether or not to display either “comment” or “comments” depending on if there is one comment or multiple comments. So something is causing it to show both of them instead of one or the other.
Here is a picture to help you understand:
PictureSo far I’ve gone through the template’s php files and found the words referenced directly in a file called “legacy.comments.php” but when I changed the words to something else, it didn’t change anything on the site.
Is there some kind of cache that I need to reset to reflect the changes I’ve made in the legacy.comments.php file?
-
can you give all comment related file
replace the code with `<?php comments_number(‘No’, ‘1’, ‘%’ );?>
chinmoy, which comment related file are you talking about? And which code do I replace with `<?php comments_number(‘No’, ‘1’, ‘%’ );?>?
Thanks, and sorry if I don’t reply soon, just about to go to bed.
comments.php file
Here is what comments.php has:
<?php global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,150) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 6"; $comments = $wpdb->get_results($sql); $output = $pre_HTML; foreach ($comments as $comment) { $output .= "\n <li>"."<a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"on " . $comment->post_title . "\">" .strip_tags($comment->comment_author) .": " . strip_tags($comment->com_excerpt) ."...</a></li> "; } $output .= $post_HTML; echo $output; ?>try this file legacy.comments.php
Here’s legacy.comments.php:
<?php // Do not delete these lines if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!'); if (!empty($post->post_password)) { // if there's a password if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie ?> <p class="nocomments">This post is password protected. Enter the password to view comments.</p> <?php return; } } /* This variable is for alternating comment background */ $oddcomment = 'alt'; ?> <?php global $bm_comments; global $bm_trackbacks; split_comments( $comments ); ?> <!-- You can start editing here. --> <?php if ($comments) : ?> <?php $trackbackcounter = count( $bm_trackbacks ); $commentcounter = count( $bm_comments ); ?> <h3 class="commh2">Comments For This Post <span class="calltoaction">We'd Love to Hear Yours!</span></h3> <ol class="commentlist"> <?php foreach ($bm_comments as $comment) : ?> <li class="<?php echo $oddcomment; ?> <?php if(function_exists("author_highlight")) author_highlight(); ?>" id="comment-<?php comment_ID() ?>"> <?php if (function_exists('get_avatar')) { ?> <span class='gravatar'> <?php echo get_avatar($comment, $size = '48', $default = $GLOBALS['defaultgravatar'] ); ?> </span> <?php } ?> <cite><?php comment_author_link() ?></cite> Says: <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> <br /> <span class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('j F Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('edit','',''); ?></span> <?php comment_text() ?> </li> <?php /* Changes every other comment to a different class */ if ('alt' == $oddcomment) $oddcomment = ''; else $oddcomment = 'alt'; ?> <?php endforeach; /* end for each comment */ ?> </ol> <?php if ( count( $bm_trackbacks ) > 0 ) { ?> <h3 class="commh2"><?php echo $trackbackcounter; ?> Trackbacks For This Post</h3> <ol class="commentlist"> <?php foreach ($bm_trackbacks as $comment) : ?> <li class="<?php echo $oddcomment; ?> <?php if(function_exists("author_highlight")) author_highlight(); ?>" id="comment-<?php comment_ID() ?>"> <cite><?php comment_author_link() ?></cite> Says: <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> <br /> <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small> <?php comment_text() ?> </li> <?php /* Changes every other comment to a different class */ if ('alt' == $oddcomment) $oddcomment = ''; else $oddcomment = 'alt'; ?> <?php endforeach; /* end for each comment */ ?> </ol> <?php } ?> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. --> <?php else : // comments are closed ?> <!-- If comments are closed. --> <p class="nocomments">Comments are closed.</p> <?php endif; ?> <?php endif; ?> <?php if ('open' == $post->comment_status) : ?> <h3 class="commh2">Leave a Comment <span class="calltoaction">Here's Your Chance to Be Heard!</span></h3> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p class="alert">You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p> <?php else : ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »</a></p> <?php else : ?> <p style="padding:5px 0px 10px 0px;"><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p> <p style="padding:5px 0px 10px 0px;"><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> <label for="email"><small>Email (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p> <p style="padding:5px 0px 10px 0px;"><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><small>Website</small></label></p> <?php endif; ?> <!--<p><small><strong>XHTML:</strong> You can use these tags: <?php echo allowed_tags(); ?></small></p>--> <p style="padding:5px 0px 10px 0px;"><textarea name="comment" id="comment" style="width:97%;" rows="10" tabindex="4"></textarea></p> <?php if (function_exists('show_subscription_checkbox')) { ?> <p style="padding:5px 0px 10px 0px;"><?php show_subscription_checkbox(); ?></p> <?php } ?> <p style="padding:10px 0px 10px 0px;"><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" onmouseover="style.cursor='pointer'" /> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p> <?php do_action('comment_form', $post->ID); ?> </form> <?php endif; // If registration required and not logged in ?> <?php endif; // if you delete this the sky will fall on your head ?>edit this line `<h3 class=”commh2″>Comments For This Post <span class=”calltoaction”>We’d Love to Hear Yours!</span></h3>
`
with<h3 class="commh2"><?php echo $commentcounter; ?> Comments For This Post <span class="calltoaction">We'd Love to Hear Yours!</span></h3>Ignore my previous comment.
try this code :
<h3 class="commh2"><?php echo $commentcounter; ?> <?php echo (($commentcounter > 1) ? 'Comments': 'Comment');?> For This Post <span class="calltoaction">We'd Love to Hear Yours!</span></h3>Trie that but it didn’t make a difference. It’s as if legacy.comments.php isn’t being used.
The topic ‘“Comment Comments For This Post”’ is closed to new replies.