Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

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!

share|improve this answer
    
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 –  Piet Sep 7 '12 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. –  Sandro Dzneladze Sep 7 '12 at 15:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.