function dwqa_single_postclass($post_class) { global $post, $current_user; if (get_post_type($post) == 'dwqa-answer') { $post_class[] = 'dwqa-answer'; $post_class[] = 'dwqa-status-' . get_post_status($post->ID); if (dwqa_is_answer_flag($post->ID)) { $post_class[] = 'answer-flagged-content'; } if (user_can($post->post_author, 'edit_published_posts')) { $post_class[] = 'staff'; } $question_id = get_post_meta($post->ID, '_question', true); $best_answer_id = dwqa_get_the_best_answer($question_id); if ($best_answer_id && $best_answer_id == $post->ID) { $post_class[] = 'best-answer'; } if (!is_user_logged_in() || $current_user->ID != $post->ID || !current_user_can('edit_posts')) { $post_class[] = 'dwqa-no-click'; } } if (get_post_type($post) == 'dwqa-answer' && get_post_type($post) == 'dwqa-question') { if (in_array('hentry', $post_class)) { unset($post_class); } } return $post_class; }
<div class="dwqa-content"> <?php if (dwqa_is_answer_flag($answer_id)) { ?> <p class="answer-flagged-alert alert"> <i class="fa fa-flag"></i> <?php _e('This answer was flagged as spam.', 'dwqa'); echo ' <strong class="answer-flagged-show">' . __('show', 'dwqa') . '</strong>'; ?> </p> <?php } ?> <div class="dwqa-content-inner <?php echo dwqa_is_answer_flag($answer_id) ? 'dwqa-hide' : ''; ?> "> <?php the_content(); ?> </div> <span class="dwqa-anchor"> <?php if (get_post_status(get_the_ID()) == 'publish') { $is_the_best = dwqa_is_the_best_answer($answer_id, $question_id); $data = is_user_logged_in() && ($current_user->ID == $question->post_author || current_user_can('edit_posts')) ? 'data-answer="' . get_the_ID() . '" data-nonce="' . wp_create_nonce('_dwqa_vote_best_answer') . '" data-ajax="true"' : 'data-ajax="false"'; ?> <?php if ($is_the_best || $data != 'data-ajax="false"') {