AnsPress_Common_Pages::question_page()

Description #

Output single question page.

Changelog #

VersionDescription
4.1.3Re-setup current post.
4.1.15Add while loop.
4.1.0Changed template file name to single-question.php to question.php.
0.0.1Introduced.

Source #

File: includes/common-pages.php

	public static function question_page() {
		global $question_rendered, $post;

		$question_rendered = false;
		$msg               = self::question_permission_msg( $post );

		// Check if user have permission.
		if ( false !== $msg ) {
			status_header( 403 );
			echo '<div class="ap-no-permission">' . $msg . '</div>'; // WPCS: xss okay.
			$question_rendered = true;
			return;
		}

		if ( have_posts() ) {
			while ( have_posts() ) : the_post();
				include ap_get_theme_location( 'single-question.php' );
			endwhile;
		}

		/**
		 * An action triggered after rendering single question page.
		 *
		 * @since 0.0.1
		 */
		do_action( 'ap_after_question' );

		$question_rendered = true;
	}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment