?> <?php apoc_loop_subforums(); ?> <?php // Single non-category forums } else { ?> <header class="forum-header"> <div class="forum-content"><h2>Forum</h2></div> <div class="forum-count">Topics</div> <div class="forum-freshness">Latest Post</div> </header> <ol class="forums category <?php bbp_forum_status(); ?> "> <li id="forum-<?php bbp_forum_id(); ?> " class="forum"> <div class="forum-content"> <h3 class="forum-title"><a href="<?php bbp_forum_permalink(); ?> " title="Browse <?php bbp_forum_title(); ?> "><?php
/** * Display nested subforums with a hierarchical structure using their parent category * @version 2.0 */ function apoc_loop_subforums() { // Exclude private forums $private = apoc_private_forum_ids(); // Check for subforums $subs = bbp_forum_get_subforums(array('post__not_in' => $private)); if (empty($subs)) { return; } // Buffer output ob_start(); // Print a header ?> <header class="forum-header"> <div class="forum-content"><h2><?php bbp_forum_title(); ?> </h2></div> <div class="forum-count">Topics</div> <div class="forum-freshness">Latest Post</div> </header> <ol class="forums category <?php bbp_forum_status(); ?> "><?php // Loop over forums foreach ($subs as $count => $sub) { // Get forum details $sub_id = $sub->ID; $title = $sub->post_title; $desc = $sub->post_content; $permalink = bbp_get_forum_permalink($sub_id); // Get topic counts $topics = bbp_get_forum_topic_count($sub_id, false); // Get the most recent reply and its topic $reply_id = bbp_get_forum_last_reply_id($sub_id); $topic_id = bbp_is_reply($reply_id) ? bbp_get_reply_topic_id($reply_id) : $reply_id; $topic_title = bbp_get_topic_title($topic_id); $link = bbp_get_reply_url($reply_id); // Get the author avatar $user_id = bbp_get_reply_author_id($reply_id); $avatar = apoc_get_avatar(array('user_id' => $user_id, 'link' => true, 'size' => 50)); // Toggle html class $class = $count % 2 ? 'odd' : 'even'; // Print output ?> <li id="forum-<?php echo $sub_id; ?> " class="forum <?php echo $class; ?> "> <div class="forum-content"> <h3 class="forum-title"><a href="<?php echo $permalink; ?> " title="Browse <?php echo $title; ?> "><?php echo $title; ?> </a></h3> <p class="forum-description"><?php echo $desc; ?> </p> </div> <div class="forum-count"> <?php echo $topics; ?> </div> <div class="forum-freshness"> <?php echo $avatar; ?> <div class="freshest-meta"> <a class="freshest-title" href="<?php echo $link; ?> " title="<?php echo $topic_title; ?> "><?php echo $topic_title; ?> </a> <span class="freshest-author">By <?php bbp_author_link(array('post_id' => $reply_id, 'type' => 'name')); ?> </span> <span class="freshest-time"><?php bbp_topic_last_active_time($topic_id); ?> </span> </div> </div> </li> <?php } ?> </ol> <?php // Retrieve from buffer $output = ob_get_contents(); ob_end_clean(); echo $output; }