bbpressの最近の投稿を表示する

forum_id は、bbpressのフォーラムの編集画面で、URLに 例えば、post.php?post=26279&action=edit と表示される postの番号(この場合は26279)を指します。

<?php
$bbp_loop_args = array( 'post_parent'=> forum_id, 'post_type'=> 'topic', 'posts_per_page'=> 5, 'comment_count'=> '1', 'orderby'=> 'newest' );
$BB_Query = new WP_Query( $bbp_loop_args );

if ( $BB_Query->have_posts() ) {

	$html= '
  • %1$s%3$s%4$d
  • '; ?><ul><?php while ( $BB_Query->have_posts() ) { $BB_Query->the_post(); $author_link = bbp_get_topic_author_link( array( 'post_id'=> get_the_ID(), 'type'=> 'avatar', 'size'=> 32 ) ); $avatar_allowd_tags= array( 'a'=> array( 'href'=> true, 'id'=> true, 'class'=> true, target=> true ), 'img'=> array( 'src'=> true, 'id'=> true, 'alt'=> true, 'class'=> true ), ); printf( $html, wp_kses( $author_link, $avatar_allowd_tags ), esc_url( bbp_get_topic_permalink() ), wp_kses( bbp_get_topic_title(),array() ), absint( bbp_get_topic_reply_count( get_the_ID() ) ) ); } ?></ul><?php

    }
    wp_reset_query();
    ?>

    [emulsion_relate_posts]