Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How do I extract a topic/reply excerpt?

@michaelhpdx

Participant

Okay, I’ve made some progress with this, though it’s not quite where I want it to be. I’ve been playing around with the function calls in bbp-topic-template.php, and been able to create a block of code that creates excerpts of topics (though not replies to topics…yet).

Here’s the resulting output: http://www.dalluva.com/temp/example-excerpt-block-getting-there.JPG

And here’s the code block (so far):

$max_shown = 3;
$parent_forum = 'any';
$excerpt_length = 200;
$avatar_size = 60;

$topics_query = array(
    'author'         => 0,
    'post_type'      => bbp_get_topic_post_type(),
    'post_parent'    => $parent_forum,
    'posts_per_page' => $max_shown,
    'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
    'show_stickes'   => false,
    'meta_key'       => '_bbp_last_active_time',
    'orderby'        => 'meta_value',
    'order'          => 'DESC',
    'meta_query'     => array( bbp_exclude_forum_ids( 'meta_query' ) )
    );

$topic_query = new WP_Query( $topics_query );
if ( $topic_query->have_posts() ) :
    $first_time = 1;
    ?>

        have_posts() ) :
            if ( $first_time == 1 ) : $first_time = 0;
            else : echo "" ;
            endif;
            $topic_query->the_post();
            $topic_id = bbp_get_topic_id( $topic_query->post->ID ); ?>


                <a class="home-topics-a" href="" title="">
                In Forum ""
                By , Posted about 


                <a class="home-topics-more more" title="Join the Conversation" href=""> READ MORE


     <?php
endif;

I'm going to keep working this and I'll post my final results in the coming days. Any comments/input are appreciated. Cheers. Michael

Skip to toolbar