Retrieving Comments from Blog Posts
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Retrieving Comments from Blog Posts’ is closed to new replies.
The topic ‘Retrieving Comments from Blog Posts’ is closed to new replies.
(@tilmishra)
14 years, 11 months ago
Hello Again,
Slowly understanding WordPress but as I look through their site, I don’t see anything that shows what variables/classes/functions WordPress uses. This site: http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html isn’t too bad.
What I’m trying to do, is for each comment made for a post. How do you retrieve the comment for that specific post?
I know the $wp_posts is a stdClass which shows how many comments are related to the post but there’s no ID linking the comments to the post.
Array
(
[0] => stdClass Object
(
[ID] => 1
[post_author] => 1
[post_date] => 2011-04-28 23:15:19
[post_date_gmt] => 2011-04-28 23:15:19
[post_content] => Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
[post_title] => Post1
[post_excerpt] =>
[post_status] => publish
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => hello-world
[to_ping] =>
[pinged] =>
[post_modified] => 2011-04-29 22:26:44
[post_modified_gmt] => 2011-04-29 22:26:44
[post_content_filtered] =>
[post_parent] => 0
[guid] => http:/….
[menu_order] => 0
[post_type] => post
[post_mime_type] =>
[comment_count] => 2
[filter] => raw
)
)
So what do I need to do, to show the comments for that post?
Thanks,
Til
P.S. if I missed something just let me know and this is the code I have so far:
[please mark all code using the ‘code’ button;
for any code longer than 10 lines, please use the pastebin]