* @license GPL-2.0+ * @link https://anspress.io * @copyright 2014 Rahul Aryan */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { die(); } /** * Meta box class. * Registers meta box for admin post edit screen. */ class AP_Question_Meta_Box { /** * Initialize the class. */ public function __construct() { add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) ); } /** * Hook meta boxes in post edit screen. * * @param string $post_type Post type. */ public function add_meta_box( $post_type ) { if ( 'question' === $post_type ) { add_meta_box( 'ap_answers_meta_box' , sprintf( __( ' %d Answers', 'anspress-question-answer' ), ap_get_answers_count() ), array( $this, 'answers_meta_box_content' ), $post_type, 'normal', 'high' ); } if ( 'question' === $post_type || 'answer' === $post_type ) { add_meta_box( 'ap_question_meta_box' ,__( 'Question', 'anspress-question-answer' ), array( $this, 'question_meta_box_content' ), $post_type, 'side', 'high' ); } } /** * Render Meta Box content. */ public function answers_meta_box_content() { ?>

ID ); $vote_count = ap_get_votes_net( $_post ); ?> 'ap_ajax', 'ap_ajax_action' => 'ap_clear_flag', '__nonce' => wp_create_nonce( 'clear_flag_' . $post->ID ), 'post_id' => $post->ID, ); ?>