[resolved] A comment box for index page (the page, no the posts inside the loop) (2 posts)

  1. achsanos
    Posted 2 years ago #

    I want to place a custom comment box on index.php, and I did it inserting a call to the comments_template:

    $withcomments = 1;

    However, the comment box is getting the id of the last post called in the loop, redirecting to it page after done a comment. I need a comment box for the index.php, not for posts (and no redirections). Is there something wrong?

  2. bcworkz
    Posted 2 years ago #

    All comments need to be related to a post ID, even if you don't care to. You could create a "dummy" page for the sole purpose of having a post ID to use for these comments unrelated to posts. Before calling comments_template(), set the global $post->ID to the dummy page ID. Doing this should be OK as long as it is done outside of the "Loop".

Topic Closed

This topic has been closed to new replies.

About this Topic