Support » Plugins » Hacks » A comment box for index page (the page, no the posts inside the loop)

  • Resolved achsanos

    (@achsanos)


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

    $withcomments = 1;
    comments_template();

    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?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    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”.

Viewing 1 replies (of 1 total)
  • The topic ‘A comment box for index page (the page, no the posts inside the loop)’ is closed to new replies.