WordPress.org

Ready to get started?Download WordPress

Forums

How to put comments on the main (index.php) page? (5 posts)

  1. timoni
    Member
    Posted 6 years ago #

    According to the Codex:

    you'll need to set the $withcomments variable to "1" before calling this tag.

    Okay, fine. How do I do this?

  2. David Yeiser
    Member
    Posted 6 years ago #

    Are you wanting to display the most recent comments across the site? Or do you want to display the associated comments with each post on the front page without having to click on a "Comments" link?

  3. stuntmusic
    Member
    Posted 6 years ago #

    I am looking for this functionality as well. My client wants a "comments" link to appear in the main page of the site, something you can click on to leave a comment.

    I've tried to use a PHP call in idex.php, but can't figure out how to dynamically pull the post ID into the page.

    Any hel?

  4. ellagray
    Member
    Posted 6 years ago #

    You include <?php comments_template(); ?> in the posts loop and you add <?php $withcomments = TRUE;
    ?> in the same file (index.php in this case). I added it at the top of the page, after <?php get_header(); ?>
    :)

  5. henigushi
    Member
    Posted 6 years ago #

    You can also combine ellagray's lines:
    <?php $withcomments = true; comments_template();?>

    See:
    http://wordpress.org/support/topic/83919?replies=8

Topic Closed

This topic has been closed to new replies.

About this Topic