Show the comments from custom post type in wordpress

Some time we shows the posts and there comments in sidebar. But what to do for show the comments for custom post type.

It’s not well documented, but according to the codex, you can pass a ‘post_type’ variable in the get_comments function.

<?php
 $comments = get_comments('number=10&status=approve&post_type=YOUR_POST_TYPE');
foreach($comments as $comment) :

// comment loop code will go here

endforeach;
?>

Note: This code only useful after wordpress 3.1 version.

Show the comments from custom post type in wordpress

Show the comments from custom post type in wordpress

You may like following Articles!

  • http://digcms.com John

    You have great knowledge