Beispiel #1
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();
}
					</div>
					<?php 
        do_action('qa_after_question');
        ?>
				</div>
				<?php 
        do_action('qa_after_question_loop');
        ?>
			<?php 
    }
    $wp_query->set('posts_per_page', 6);
    ?>
			</div><!--#question-list-->
			
			<?php 
    the_qa_pagination();
    ?>
			
			<?php 
    do_action('qa_after_content', 'archive-question');
    ?>
		
		<?php 
}
?>
	</div>
</div><!--#qa-page-wrapper-->
<?php 
global $qa_general_settings;
if (isset($qa_general_settings["page_layout"]) && $qa_general_settings["page_layout"] != 'content') {
    get_sidebar('question');
function do_qa_archive()
{
    ?>
  <div class="post_box top">
    <div class="format_text">
      <?php 
    //get_header( 'question' );
    ?>

      <div id="qa-page-wrapper">
        <div id="qa_banner"></div>
        <?php 
    the_qa_error_notice();
    ?>
        <?php 
    the_qa_menu();
    ?>

        <?php 
    if (!have_posts()) {
        ?>

        <p><?php 
        $question_ptype = get_post_type_object('question');
        echo $question_ptype->labels->not_found;
        ?>
</p>

        <?php 
    } else {
        ?>

        <div id="question-list">
          <?php 
        while (have_posts()) {
            the_post();
            ?>
          <div class="question">
            <div class="question-stats">
              <?php 
            the_question_score();
            ?>
              <?php 
            the_question_status();
            ?>
            </div>
            <div class="question-summary">
              <h3><?php 
            the_question_link();
            ?>
</h3>
              <div class="question-excerpt">
                <?php 
            the_excerpt();
            ?>
              </div>
              <?php 
            the_question_tags('<div class="question-tags">', ' ', '</div>');
            ?>
              <div class="question-started">
                <?php 
            the_qa_time(get_the_ID());
            ?>
                <?php 
            //the_qa_user_link( $post->post_author );
            ?>
              </div>
              <?php 
            the_qa_author_box(get_the_ID());
            ?>
            </div>
          </div>
          <?php 
        }
        ?>
        </div><!--#question-list-->

        <?php 
        the_qa_pagination();
        ?>

        <?php 
    }
    ?>

      </div><!--#qa-page-wrapper-->

      <?php 
    //get_sidebar( 'question' );
    ?>

      <?php 
    //get_footer( 'question' );
    ?>
    </div>
  </div>
  <?php 
}