Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress shortcode – show post extract


  • ttmt
    Participant

    @ttmt

    Hi all

    I’m using a WP multisite. One of the sites is a bbpress forum.

    On another site I’m pulling through the lastest post using the code below

    The only thing I can’t seem to find is the shortcode to show an extract of the post.

    Is there a shortcode to show an extract of the post.

    
    <?php
        switch_to_blog( 3 );
        $topics_query = array(
          'author'=> 0, 
          'post_type'=> bbp_get_topic_post_type(), 
          'post_parent'=>'any', 
          'posts_per_page'=>3, 
          //'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'))
        );
        
        $widget_query = new WP_Query($topics_query);
    
        if ($widget_query->have_posts()) :
          $widget_output = $before_widget;
          $widget_output .= $before_title . $title . $after_title;
          ob_start();
    
        while ($widget_query->have_posts()):
          $widget_query->the_post();
          $topic_id = bbp_get_topic_id($widget_query->post->ID);
          $author_link = bbp_get_topic_author_link(array('post_id'=>$topic_id, 'type'=>'both', 'size'=>60));
          $forum_id = bbp_get_topic_forum_id($topic_id);   
      ?>
    
      <div class="col-sm-4"> 
        <div class="post">
          <h4><a>"><?php bbp_topic_title($topic_id); ?></a></h4>
          <p class="date"><span><?php bbp_author_link($topic_id); ?></span> <?php bbp_topic_last_active_time($topic_id);?></p>
          <p> <!--show post extract--> </p>
          <a href="">Read more</a>
        </div>
      </div>
    
      <?php 
        endwhile; 
        endif; 
        wp_reset_postdata();
      ?>
    
Viewing 1 replies (of 1 total)

  • Robkk
    Moderator

    @robkk

    its not a shortcode but i think you need one of these

    bbp_reply_content()
    bbp_get_reply_content()
    bbp_reply_excerpt()
    bbp_get_reply_excerpt()

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar