AnsPress_Admin::menu_counts()
Description #
Menu counter
Source #
File: admin/anspress-admin.php
public static function menu_counts() {
$flagged = ap_total_flagged_count();
$q_flagged = $flagged['questions'];
$a_flagged = $flagged['answers'];
$question_count = wp_count_posts( 'question', 'readable' );
$answer_count = wp_count_posts( 'answer', 'readable' );
$types = array(
'question' => ( ! empty( $question_count->moderate ) ? $question_count->moderate : 0 ) + $q_flagged->total,
'answer' => ( ! empty( $answer_count->moderate ) ? $answer_count->moderate : 0 ) + $a_flagged->total,
'flagged' => $q_flagged->total + $a_flagged->total,
);
$types['total'] = (int) $types['flagged'];
$types_html = array();
foreach ( (array) $types as $k => $count ) {
if ( $count > 0 ) {
$types_html[ $k ] = ' <span class="update-plugins count ap-menu-counts"><span class="plugin-count">' . number_format_i18n( $count ) . '</span></span>';
} else {
$types_html[ $k ] = '';
}
}
return $types_html;
}
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:153
Add your comment