AnsPress_Theme::template_include_theme_compat( string $template = '' )

Description #

Reset main query vars and filter ‘the_content’ to output a AnsPress template part as needed.

Parameters #

  • $template
    string (Optional) Template name. Default value: ''

Changelog #

VersionDescription
4.2.0Introduced.

Source #

File: includes/class-theme.php

	public static function template_include_theme_compat( $template = '' ) {
		if ( ap_current_page( 'question' ) ) {
			ob_start();
			echo '<div class="anspress" id="anspress">';
			AnsPress_Common_Pages::question_page();
			echo '</div>';
			$html = ob_get_clean();

			ap_theme_compat_reset_post(
				array(
					'ID'             => get_question_id(),
					'post_title'     => get_the_title( get_question_id() ),
					'post_author'    => get_post_field( 'post_author', get_question_id() ),
					'post_date'      => get_post_field( 'post_date', get_question_id() ),
					'post_content'   => $html,
					'post_type'      => 'question',
					'post_status'    => get_post_status( get_question_id() ),
					'is_single'      => true,
					'comment_status' => 'closed',
				)
			);
		}

		if ( true === anspress()->theme_compat->active ) {
			ap_remove_all_filters( 'the_content' );
		}

		return $template;
	}

Leave a Reply

Your email address will not be published.

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

Add your comment