• Anyone know what code is needed to display the comments underneath the blog entries on the front page (index.php). Obviously inline comments work on the individual entry archive screens, but I can’t get comments to display on the main page where there is more than one blog entry being shown.

Viewing 15 replies - 1 through 15 (of 21 total)
  • funny how i was searching for this just now, and you JUST created this…*giggle*….Thank you! ??
    *waiting for response from WordPress experts*

    Just move the comment section up higher in the loop.

    Thread Starter odaat

    (@odaat)

    Well, you would think it would be that easy wouldn’t you. Unfortunately it doesn’t work.

    See the other thread, I tested it and it does work.

    <?php the_content(); require(ABSPATH . ‘wp-comments.php’); ?>
    and see if it fails and why as the include worked on my test blog.

    Thread Starter odaat

    (@odaat)

    Ok. It didn’t fail. Just didn’t make any difference. Am I supposed to be adding any other code to display the comments under the posts?
    I tried:
    <?php if ($comments) { ?>
    <?php foreach ($comments as $comment) { ?>
    <div class="comment"><li id="comment-<?php comment_ID() ?>">
    <div class="title"><?php comment_text() ?></div>
    "> <?php comment_type(); ?> <?php _e("by"); ?> <?php comment_author_link() ?></div>
    <?php } // end for each comment ?>

    <?php } else { // this is displayed if there are no comments so far ?>
    <?php _e("Make a comment, dammit!"); ?>
    <?php } ?>

    after the comments pop up link, but all I get is “Make a comment, dammit” appear at the bottom of the post, even when there are comments.

    No, including wp-comments just after the_content should work. *Nothing* was displayed? Hmmm, that just does not make sense – *something* should have displayed. I also tested index.php?p=1298 on your site and the comments and form are displayed. Is the link to your blog the one you are trying to tweak?

    Thread Starter odaat

    (@odaat)

    I think there may be a misunderstanding. The comments are displayed fine on the individual entry archive pages, but I want them displayed on the front page too.
    Stupid thing.
    Maybe MT 3.1 was a better idea after all.

    I am trying a similar project, and keep getting the same results. If you have discovered the trick to getting the comments to show up on the front page, please let me know.
    I’m still new to learning the php ways of wordpress, after switching over from mt. ??
    My test blog for this item is located at lensday.com

    In wp-comments there should be a line like:
    if (($withcomments) or ($single)) {
    You need to delete that (and the corresponding closing bracket } ) to have comments show on the front page. What I would actually suggest is copying wp-comments.php to a different file, making the changes you want there, and then changing that line to
    if (!$single) {
    and including the file. (Note the exclamation point.)

    Yep, ODATT figured it out last night and hopefully courtneyelizabeth will check here too since she is running a similar thread.

    I check for this line in the wp-comment.php, and I couldn’t find it. I currently just have the basic wp-comment.php template running.

    okay. i was able to find it, and was able to display comments on the front page. Now, what if you want comments to be displayed on both the front page, and the corresponding permalink/archive page. I can only get it to do one or the other.

    That is what Matt is suggesting, copy the wp-comments file into another file, say “commentsfp.php” and include it after the_content with the conditional: if ( !$single ) include(ABSPATH . ‘commentsfp.php’); and leave the original include(ABSPATH . ‘wp-comments.php’); where it is in the index file.

    YAY! It worked! Thank you!
    Courtney Elizabeth
    https://www.courtneyelizabeth.com

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Display comments on front page’ is closed to new replies.