/**
  * Add flagged post view
  * @param  array $views Views array.
  * @return array
  */
 public function flag_view($views)
 {
     global $post_type_object;
     $flagged_count = ap_total_posts_count($post_type_object->name, 'flag');
     $class = isset($_GET['flagged']) ? 'class="current" ' : '';
     $views['flagged'] = '<a ' . $class . 'href="edit.php?flagged=true&#038;post_type=' . $post_type_object->name . '">' . __('Flagged', 'anspress-question-answer') . ' <span class="count">(' . $flagged_count->total . ')</span></a>';
     return $views;
 }
Example #2
0
/**
 * Return number of flagged posts
 * @return object
 * @since unknown
 */
function ap_flagged_posts_count()
{
    return ap_total_posts_count('both', 'flag');
}
/**
 * Control the output of AnsPress dashboard
 *
 * @link http://anspress.io
 * @since 2.0.0-alpha2
 * @author Rahul Aryan <*****@*****.**>
 * @package AnsPress
 */
// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}
global $questions;
$question_count = ap_total_posts_count('question');
$answer_count = ap_total_posts_count('answer');
$flagged_count = ap_total_posts_count('both', 'flag');
?>

<div id="anspress" class="wrap">
	<?php 
do_action('ap_before_admin_page_title');
?>

	<h2><?php 
_e('AnsPress Dashboard', 'ap');
?>
</h2>

	<div class="row ap-dash-tiles">
		<div class="ap-dash-tile col-md-6">
			<div class="ap-dash-tile-in ap-tile anspress-stats-count">
Example #4
0
function ap_total_published_questions()
{
    $posts = ap_total_posts_count();
    return $posts->publish;
}
Example #5
0
 /**
  * Menu counter
  * @return array
  * @since 2.4.6
  */
 public function menu_counts()
 {
     $q_flagged_count = ap_total_posts_count('question', 'flag');
     $a_flagged_count = ap_total_posts_count('answer', 'flag');
     $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_count->total, 'answer' => (!empty($answer_count->moderate) ? $answer_count->moderate : 0) + $a_flagged_count->total, 'flagged' => $q_flagged_count->total + $a_flagged_count->total);
     $types['total'] = array_sum($types);
     $types_html = array();
     foreach ($types as $k => $count) {
         if ($count > 0) {
             $types_html[$k] = ' <span class="update-plugins count"><span class="plugin-count">' . number_format_i18n($count) . '</span></span>';
         } else {
             $types_html[$k] = '';
         }
     }
     return $types_html;
 }