Support » Fixing WordPress » Specifying post id

  • Let’s say I have a page, but I want to get comments from a post with a different ID number.

    how do I get comments that are associated with certain post id’s?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try it again…
    You mean you want comments from post ID 123 to be displayed on your page ID 789?
    I don’t think that would work.

    …why not?

    okay, so what I actually want is for comments from post id 33 to be displayed on my dashboard.

    When I threw in the comment_template tag (with some modifications so it’ll work on a non-page/post page) it randomly chose to display comments from post id 29. How do I change that number to 33?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Set the $post->ID global variable to the post id you want before you call the comments_template() function.

    $post->ID = 33;

    WOW it worked!!!!! dang I didn’t know you can just set $post->ID to a number. That’s so easy. I can’t believed I searched the WHOLE morning for this simple little thing. Thank you thank you thank you!!!

    now I have a message board on my dashboard 😀

    I have the same prob. i want to have a post or a page comment to my index. and use it as a guestbook/comment.

    when changeing to “$post->ID = 33;” the comment-list lists posts from 33. but when writing a comment it still writes it to the first comment thats on the index page. and that is “51”

    and it also says “11 Comments”, and thats from post “51”

    help me out please!

    Is there some more code i must call soo that the comment field will understand that its $post->ID = 33 and not the last post in the news feed….
    like $comment->ID or something like that…

    Help needed!

    ok, found it out..

    $id = 86; $post->ID = 86; comments_template();

    $post->ID will only call the list off comments
    while $id will call the numbers of comments and fix the submit form

    hope it helps someone.. cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Specifying post id’ is closed to new replies.