Beispiel #1
0
 function vote()
 {
     global $_qa_votes;
     $_qa_votes->handle_voting();
     $id = $_POST['post_id'];
     $post_type = get_post_type($id);
     if ('question' == $post_type) {
         the_question_voting($id);
     } elseif ('answer' == $post_type) {
         the_answer_voting($id);
     } else {
         die(-1);
     }
     die;
 }
Beispiel #2
0
function the_answer_list()
{
    $question_id = get_the_ID();
    #	if ( !current_user_can( 'read_answers', $question_id ) )
    #		return;
    $accepted_answer = get_post_meta($question_id, '_accepted_answer', true);
    $answers = new WP_Query(array('post_type' => 'answer', 'post_parent' => $question_id, 'post__not_in' => array($accepted_answer), 'orderby' => 'qa_score', 'posts_per_page' => QA_ANSWERS_PER_PAGE, 'paged' => get_query_var('paged')));
    if ($accepted_answer && !get_query_var('paged')) {
        array_unshift($answers->posts, get_post($accepted_answer));
    }
    the_qa_pagination($answers);
    foreach ($answers->posts as $answer) {
        setup_postdata($answer);
        ?>
	<div id="answer-<?php 
        echo $answer->ID;
        ?>
" class="answer">
		<?php 
        the_answer_voting($answer->ID);
        ?>
		<div class="answer-body">
			<?php 
        echo get_the_content();
        ?>
			<?php 
        the_qa_author_box($answer->ID);
        ?>
			<?php 
        the_qa_action_links($answer->ID);
        ?>
		</div>
	</div>
<?php 
    }
    the_qa_pagination($answers);
    wp_reset_postdata();
}