function ap_append_vote_count($post) { if (!is_question() && ($post->post_type == 'question' || $post->post_type == 'answer')) { $post->net_vote = ap_net_vote_meta($post->ID); $post->selected = get_post_meta($post->ID, ANSPRESS_SELECTED_META, true); $post->closed = get_post_meta($post->ID, ANSPRESS_CLOSE_META, true); } elseif ($post->post_type == 'question' || $post->post_type == 'answer') { //voted up count if (is_object($post)) { $votes = ap_post_votes($post->ID); // net vote $post->voted_up = $votes['voted_up']; $post->voted_down = $votes['voted_down']; $post->net_vote = $votes['voted_up'] - $votes['voted_down']; //closed count $post->closed = get_post_meta($post->ID, ANSPRESS_CLOSE_META, true); $post->selected = get_post_meta($post->ID, ANSPRESS_SELECTED_META, true); //flagged count $post->flag = get_post_meta($post->ID, ANSPRESS_FLAG_META, true); //favorite count $post->favorite = get_post_meta($post->ID, ANSPRESS_FAV_META, true); $post->voted_closed = ap_is_user_voted_closed(); $post->flagged = ap_is_user_flagged(); //if current logged in user voted if (is_user_logged_in()) { $post->favorited = ap_is_user_favorite($post->ID); $userid = get_current_user_id(); $post->user_voted_up = ap_is_user_voted($post->ID, 'vote_up', $userid); $post->user_voted_down = ap_is_user_voted($post->ID, 'vote_down', $userid); } } } }
/** * Append variable to post Object. * @param Object $post Post object. */ public function ap_append_vote_count($post) { if ($post->post_type == 'question' || $post->post_type == 'answer') { if (is_object($post)) { $post->net_vote = ap_net_vote_meta($post->ID); } } }
/** * Append variable to post Object. * @param Object $post Post object. */ public function ap_append_vote_count($post) { if ($post->post_type == 'question' || $post->post_type == 'answer') { if (is_object($post)) { $post->net_vote = ap_net_vote_meta($post->ID); } } if (ap_opt('base_page') == $post->ID && !is_admin()) { $post->post_title = ap_page_title(); } }