cmacnaug
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Show comments on front pageI had the same problem with WP 1.2.2. I modified my
wp-includes/template-functions-comment.php file as follows. This shows only the comments without the whole post form. I don’t know PHP so make sure you back up this file before attempting.!I changed the function: comments_popup_link. This is the function that shows the Comments(0) link. I modified it to show the same stuff that is shown on the Comment editing page. The only drawback is that a lot of stylesheets out there will show the comments left aligned so you may need to update your stylesheets. You can check it out on
http://nicksrecovery.com/index.php?m=20050125To do it:
Step 1.
First edit line 61 from:
global $comment_count_cache, $single;to:
global $comment_count_cache, $single, $comment;2.
This should be placed at the end of the function comments_popup_link (around line 99) just before the closing bracket.
if($number > 0)
{
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = "$id" AND comment_approved = "1" ORDER BY comment_date");
if ($comments)
{
//echo "<h3> Comments:</h3>";
echo "<ol id="commentlist">";
foreach ($comments as $comment)
{
echo "<li id="comment">";comment_text();
echo "<cite>";
comment_type();
echo " by ";
comment_author_link();
comment_date();
echo " @ <a href="#comment-";
comment_ID();
echo"">";
comment_time();
echo "</a>";
edit_comment_link(__("Edit This"), " |");
echo "</cite>";echo "</li>
";
}
echo "</ol>
";
}
}