/** * Add answer-seleted class in post_class * @param array $classes Post class attribute. * @return array * @since 2.0.1 */ public function question_answer_post_class($classes) { global $post; if ('question' == $post->post_type) { if (ap_question_best_answer_selected($post->ID)) { $classes[] = 'answer-selected'; } if (ap_is_featured_question($post->ID)) { $classes[] = 'featured-question'; } $classes[] = 'answer-count-' . ap_count_answer_meta(); } elseif ('answer' == $post->post_type) { if (ap_answer_is_best($post->ID)) { $classes[] = 'best-answer'; } } return $classes; }
function ap_featured_post_btn($post_id = false) { if (!is_user_logged_in()) { return; } if ($post_id == false) { $post_id = get_question_id(); } if (is_super_admin()) { $output = '<a href="#" class="ap-btn-set-featured" id="set_featured_' . $post_id . '" data-action="set_featured" data-query="ap_ajax_action=set_featured&post_id=' . $post_id . '&__nonce=' . wp_create_nonce('set_featured_' . $post_id) . '" title="' . __('Make this question featured', 'ap') . '">' . (ap_is_featured_question($post_id) ? __('Unset as featured', 'ap') : __('Set as featured', 'ap')) . '</a>'; } return $output; }
if (!ap_user_can_view_post(get_the_ID())) { return; } global $post; $clearfix_class = array('ap-questions-item clearfix'); ?> <div id="question-<?php ap_question_the_ID(); ?> " <?php post_class($clearfix_class); ?> > <?php if (ap_is_featured_question()) { echo '<i class="ap-questions-featured apicon-star ap-tip" title="' . __('Featured question', 'ap') . '"></i>'; } ?> <div class="ap-questions-inner"> <div class="ap-avatar ap-pull-left"> <a href="<?php ap_question_the_author_link(); ?> "<?php ap_hover_card_attributes(ap_question_get_author_id()); ?> > <?php ap_question_the_author_avatar(ap_opt('avatar_size_list'));