Last active
March 15, 2017 20:29
-
-
Save mathetos/3c060568278c528398004685ddca3578 to your computer and use it in GitHub Desktop.
Count open child bbPress forums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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