Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get reply ids within topic loop?


  • tkomuro2k
    Member

    @tkomuro2k

    Hello guys!

    I am trying to run a replies loop within topics loop… and scratching my head..
    (more specifically, at loop-single-topic.php compat template .. I am trying to do something like..

            bbp_has_replies();
            while ( bbp_replies() ) : bbp_the_reply();
            $current_topic_reply_id = bbp_get_reply_id();
            echo $current_topic_reply_id ;
            endwhile;
    

    and.. i am getting.. same IDs under every topic..
    would you help me to get reply IDs for each topic including the topic ID itself?
    Thank you very much guys..

Viewing 2 replies - 1 through 2 (of 2 total)

  • Lynq
    Participant

    @lynq

    Have you had a look inside loop-replies.php and loop-single-reply.php to see how it is done inside there?


    tkomuro2k
    Member

    @tkomuro2k

    Thanks for the reply… temporarily I solved it by duplicating bbp_has_replies function in my function.php and changing ['post_parent'] argument to ‘post_parent’ => bbp_get_topic_id()

    It does the job now.. but I am not happy with this because I am unnecessarily duplicating the good function.. I think my add_filter is not working as I intended.. but don’t know what’s wrong with it.. Would you guys please help me?

    in function.php , I have function looks like

    function my_bbp_has_replies($arg = ”)
    {

    $args = array();
    $topic_id = bbp_get_topic_id();
    $args['post_parent'] = $topic_id;
    
    return $arg;
    

    } // function

    and after I call bbp_has_replies() , I had put add_filter(‘bbp_has_replies’, ‘my_bbp_has_replies’); in loop-single-topic.php ..

    I have looked into loop-replies.php and loop-single-reply.php .. as Lynq suggested (btw, thank you) … but there was no function or filter trying to filter the bbp_has_replies..

    Thank you guys..

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.