Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Dražen 1 year, 7 months ago.

Assisted by: Dražen.

Author Posts
July 18, 2023 at 10:10 am #14057219

ronnyK-4

Tell us what you are trying to do?

I want a list of certain bbpress topics. It is working fine on default language but not on translated.

He does echo the topic ids for the arguments but return the feedback template.

Any Ideas?

<section class="topics">

<div id="bbpress-forums" class="bbpress-wrapper">

<h3><?php echo __('Recent Topics', 'Wordpress'); ?></h3>

<?php

$topic_parents = array();

foreach ($match_parent_ids as $match_parent_id) {

$match_ids = get_children(array(
'post_parent' => $match_parent_id,
'post_type' => 'forum',
'fields' => 'ids',
));

foreach ($match_ids as $match_id) {

$topic_ids = get_children(array(
'post_parent' => $match_id,
'post_type' => 'topic',
'fields' =>'ids',
));

foreach ($topic_ids as $topic_id) {
echo $topic_id;
}

$topic_parents = array_merge($topic_parents, $topic_ids);

}

}

$args3 = array(
'post__in' => $topic_parents,
'post_type' => bbp_get_topic_post_type(),
'post_status' => bbp_get_public_status_id(),
'posts_per_page' => 10,
'orderby' => 'freshness',
'order' => 'DESC',
);

if (bbp_has_topics($args3)) :

bbp_get_template_part( 'loop', 'topics' );

else :

bbp_get_template_part( 'feedback', 'no-topics' );

endif;?>

</div>

</section>

Is there any documentation that you are following?

no

Is there a similar example that we can see?

no

What is the link to your site?

true-table.com

July 19, 2023 at 6:28 am #14062609

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I would suggest first debugging it to see what IDs are returned on default language and what is fetched on 2nd language. I suspect this is happening since you need to fetch translated post (topic) IDs via our hooks:

Please check the following docs:
- https://wpml.org/faq/how-to-get-other-languages-of-current-post/
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

Please note we can not debug or help with custom code work, but we will guide you in the correct direction of what needs to be done. If you need custom work service we suggest hiring a contractor: https://wpml.org/contractors/

Let me know how it goes and if any other questions.

Regards,
Drazen

July 19, 2023 at 7:11 am #14062763

ronnyK-4

I was trying that but as i mentioned in my post it already returns the IDs of the translated topics, thats why i was wondering why the function doesnt accept them as argument.

I hoped you maybe have a quick solution.
Thanks anyway

July 19, 2023 at 8:01 am #14063055

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

difficult to say from my side, since it would probably require debugging your custom code and setup, but what I can do is provide a test website and try to check it there.

Please set up a simple example with 1 topic using the WP default theme and only minimal required plugins (WPML, BBPress). Using only minimal custom code needed.

Login link:
- hidden link

Please share the steps you did and the steps to check the issue (what is wrong), so I can check it out and if needed consult with our 2nd tier on this.

Thanks,
Drazen

July 21, 2023 at 7:36 am #14076609

ronnyK-4

Couldnt repeat the mistake, kindo working just not on my site, you can marked as resolved, i have no clue what i messed up.
Thanks anyway

July 21, 2023 at 8:06 am #14076757

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

sure, I will mark it as resolved.

Feel free to reopen or contact us again if you still need our help.

Regards,
Drazen