Skip to:
Content
Pages
Categories
Search
Top
Bottom

bb_has_topics not working with translated topics in WPML

  • @ronnyk1988

    Participant

    Hello, i am using this code Part to show latest Topics in certain Forums. It is giving the correct Topic ids but wont show them except of original Language even if i opened it in a different language first.

    <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’ => ‘topic’,
    ‘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>

    Thanks for helping

  • You must be logged in to reply to this topic.
Skip to toolbar