WordPress.org

Ready to get started?Download WordPress

Forums

comments auto refresh (3 posts)

  1. s0206
    Member
    Posted 1 year ago #

    Hello All

    I have been trying to auto refresh the comments section on a new site I am developing. I came this excellent piece of code and it does the job brilliantly. The only thing is, it appears to display all comments from the entire blog rather the comments for the specific post.

    I can't seem to work out what is wrong, here is the code:

    http://pastebin.com/jy30qmnW

    It's taken from the wonderful blog: http://nikos-web-development.netai.net

    Can anyone help me work out what is wrong here?

    Thanks in advance

  2. bcworkz
    Member
    Posted 1 year ago #

    The database query ($request) is not restricting the search for comments with a particular post ID. You need to get the current post ID into the function somehow, then add something like AND comment_post_ID = '$current_postID' to the WHERE line.

  3. Nikos M.
    Member
    Posted 1 year ago #

    Hi s0206,

    where exactly do you use this code?
    It makes a difference if the code can access the global $post variable (which contains the curent post_id) or is used outside the Loop.

    If you can post the whole page where this code is used it could help resolve this issue

Topic Closed

This topic has been closed to new replies.

About this Topic