0

I've an unique problem, I'm using WPML to translate my website.

WPML takes post and duplicates it, so that translation becomes another post. Thus keeping Gallery/Comments/Ratings separate.

I'm on the quest to unite Gallery/Comments/Ratings for all languages.

Problem is with comments, because wp-list-comments function doesn't accept post ID as an argument.

What are my options? how do I unite comments of two posts? given that I know ID of parent and ID of translation?

I think this is an interesting question :)

ty!

1 Answer 1

0

You could use get_comments() instead. The code in this forum post gives an example of how you'd do that:

<?php
$recent_comments = get_comments( array('post_id' => $newest_post_id,) );

foreach ($recent_comments as $comment)
{
?>
<?php
$comment_id = get_comment($comment->comment_ID);
$author = $comment_id->comment_author;
$commentdate = $comment_id->comment_date;
$content = $comment_id->comment_content;
?>
<p><?php echo $author; echo $commentdate;?></p>
<p><?php echo $content;?></p>
<?php
} ?>

Best of luck!

2
  • although this might work on a mono-lingual site, this is definitely not going to work on a site with WPML enabled. Maybe when you change the 'post_id' on line 2 with icl_object_id($post->ID, 'post', true, 'en'));, it can work, but I have not tested this at all
    – user2015
    Sep 7, 2012 at 3:14
  • I used icl_object_id but it still doesn't work... I don't get comments on child posts, but on parents post it works fine event though post_id I have same. Even if I hardcode parent post ID it still doesn't show comments.
    – user8842
    Sep 7, 2012 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.