<div id="answer_<?php echo get_the_ID(); ?> " class="answer<?php echo ap_is_best_answer(get_the_ID()) ? ' selected' : ''; ?> " data-id="<?php echo get_the_ID(); ?> " itemprop="suggestedAnswer<?php echo ap_is_best_answer(get_the_ID()) ? ' acceptedAnswer' : ''; ?> " itemtype="http://schema.org/Answer" itemscope=""> <div class="ap-content clearfix"> <div class="ap-avatar"> <a href="<?php echo ap_user_link(get_the_author_meta('ID')); ?> "> <?php echo get_avatar(get_the_author_meta('user_email'), ap_opt('avatar_size_qanswer')); ?> </a> <?php echo ap_select_answer_btn_html(get_the_ID()); ?> </div> <div class="ap-content-inner no-overflow"> <div class="ap-amainc"> <div class="ap-user-meta"> <div class="ap-single-vote">
<div id="answer_<?php echo get_the_ID(); ?> " class="answer<?php echo ap_is_best_answer(get_the_ID()) ? ' selected' : ''; ?> " data-id="<?php echo get_the_ID(); ?> "> <div class="ap-content clearfix"> <div class="ap-content-inner"> <div class="ap-user-meta"> <div class="ap-avatar"> <?php echo get_avatar(get_the_author_meta('user_email'), ap_opt('avatar_size_question')); ?> </div> <div class="ap-meta"> <?php printf(__('<span class="when">answered about %s ago</span>', 'ap'), ap_human_time(get_the_time('U'))); ?> </div> </div> <div class="answer-content"> <strong class="ap-answer-title"><?php echo get_the_title($answer->post->post_parent); ?> </strong> <?php
function ap_select_answer_btn_html($post_id) { if (!ap_user_can_select_answer($post_id)) { return; } $ans = get_post($post_id); $action = 'answer-' . $post_id; $nonce = wp_create_nonce($action); if (!ap_is_answer_selected($ans->post_parent)) { return '<a href="#" class="ap-btn-select ap-sicon ap-icon-checkmark ap-tip" data-button="ap-select-answer" data-args="' . $post_id . '-' . $nonce . '" title="' . __('Select this answer as best', 'ap') . '"></a>'; } elseif (ap_is_answer_selected($ans->post_parent) && ap_is_best_answer($ans->ID)) { return '<a href="#" class="ap-btn-select ap-sicon ap-icon-checkmark selected ap-tip" data-button="ap-select-answer" data-args="' . $post_id . '-' . $nonce . '" title="' . __('Unselect this answer', 'ap') . '"></a>'; } }