/** * Output single question page * @return void */ public function question_page() { global $questions; ap_get_question(get_question_id()); if (ap_have_questions()) { while (anspress()->questions->have_posts()) { anspress()->questions->the_post(); global $post; setup_postdata($post); } include ap_get_theme_location('question.php'); wp_reset_postdata(); } else { include ap_get_theme_location('not-found.php'); } }
/** * Output single question page * @return void */ public function question_page() { global $questions; $questions = ap_get_question(get_question_id()); if (ap_have_questions()) { /** * Set current question as global post * @since 2.3.3 */ while (ap_questions()) { ap_the_question(); global $post; setup_postdata($post); include ap_get_theme_location('question.php'); } wp_reset_postdata(); } else { include ap_get_theme_location('not-found.php'); } }
/** * Control the output of [question] shortcode * @param string $content * @return string * @since 2.0.0-beta */ public function anspress_question_sc($atts, $content = '') { ob_start(); echo '<div id="anspress" class="ap-eq">'; /** * ACTION: ap_before_question_shortcode * Action is fired before loading AnsPress body. */ do_action('ap_before_question_shortcode'); $questions = ap_get_question($atts['id']); if ($questions->have_posts()) { /** * Set current question as global post * @since 2.3.3 */ while ($questions->have_posts()) { $questions->the_post(); include ap_get_theme_location('shortcode/question.php'); } } echo '</div>'; wp_reset_postdata(); return ob_get_clean(); }
/** * Output single question page * @return void */ public function question_page() { // Set Header as 404 if question id is not set. if (false === get_question_id()) { $this->set_404(); return; } global $questions; $questions = ap_get_question(get_question_id()); if (ap_have_questions()) { /** * Set current question as global post * @since 2.3.3 */ while (ap_questions()) { ap_the_question(); global $post; setup_postdata($post); } include ap_get_theme_location('question.php'); wp_reset_postdata(); } else { $this->set_404(); } }