bbp_get_forum_post_type(),
'posts_per_page' => -1,
'post_parent' => 0,
'orderby' => 'menu_order',
'order' => 'ASC',
'post_status' => 'publish',
] );
$count = $forum_query->found_posts;
// Left Sidebar Forums.
include __DIR__ . '/admin_ui/forums.php';
?>
$item,
'post_type' => bbp_get_topic_post_type(),
'orderby' => 'menu_order',
'order' => 'asc',
'posts_per_page' => -1,
'post_status' => [ 'any', 'spam' ],
]
);
$count_open = 0;
$count_closed = 0;
$count_hidden = 0;
$count_no_reply = 0;
$count_solved = 0;
$count_unsolved = 0;
$count_trash = 0;
while ( $children->have_posts() ) : $children->the_post();
$topic_id = get_the_ID();
$replies = get_children( [
'post_parent' => $topic_id,
'post_type' => bbp_get_reply_post_type(),
'post_status' => [ 'publish', 'draft', 'pending' ],
] );
// Count open/closed topics.
if ( bbp_is_topic_closed( $topic_id ) ) {
$count_closed++;
} else {
$count_open++;
}
// Count spam( hidden ) topics.
if ( bbp_is_topic_spam( $topic_id ) || bbp_is_topic_pending( $topic_id ) ) {
$count_hidden++;
}
// Replies count.
if ( 0 == count( $replies ) ) {
$count_no_reply++;
}
// Count solved.
// Before using $GLOBALS['forumax_solve_topic'], check if it is set
if (isset($GLOBALS['forumax_solve_topic']) && $GLOBALS['forumax_solve_topic']->is_solved($topic_id)) {
$count_solved++;
} else {
$count_unsolved++;
}
endwhile;
wp_reset_postdata();
$trash_topic = new WP_Query( [
'post_parent' => $item,
'post_type' => bbp_get_topic_post_type(),
'posts_per_page' => -1,
'post_status' => [ 'trash' ],
] );
while ( $trash_topic->have_posts() ) :
$trash_topic->the_post();
$trash_topic_id = get_the_ID();
// Count trash.
if ( bbp_is_topic_trash( $trash_topic_id ) ) {
$count_trash++;
}
endwhile;
wp_reset_postdata();
?>