Skip to content

Instantly share code, notes, and snippets.

@mathetos
Last active March 15, 2017 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathetos/3c060568278c528398004685ddca3578 to your computer and use it in GitHub Desktop.
Save mathetos/3c060568278c528398004685ddca3578 to your computer and use it in GitHub Desktop.
Count open child bbPress forums
<?php
$i = 0;
$children = bbp_forum_get_subforums( array( 'post_parent' => $forum_id ) );
foreach ($children as $child) :
if ( bbp_is_forum_open( $forum_id = $child->ID ) ) {
$i++;
$status = bbp_get_forum_status( $forum_id = $child->ID );
var_dump($i);
var_dump($status);
}
endforeach;
$count = ( $i == 0) ? 'All issues are closed!' : sprintf(_n('There is currently %s open issue.', 'There are currently %s open issues.', $i, 'mc_clients'), $i);
echo '<p class="issue_count">' . $count . '</p>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment