AnsPress_Common_Pages::base_page()

Description #

Layout of base page.

Source #

File: includes/common-pages.php

	public static function base_page() {
		global $wp;

		$keywords          = get_search_query();
		$tax_relation      = ! empty( $wp->query_vars['ap_tax_relation'] ) ? $wp->query_vars['ap_tax_relation'] : 'OR';
		$args              = array();
		$args['tax_query'] = array( 'relation' => $tax_relation ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query

		if ( false !== $keywords ) {
			$args['s'] = $keywords;
		}

		if ( is_front_page() ) {
			$args['paged'] = get_query_var( 'page' );
		}

		// Set post parent.
		if ( get_query_var( 'post_parent', false ) ) {
			$args['post_parent'] = get_query_var( 'post_parent' );
		}

		if ( ap_sanitize_unslash( 'unpublished', 'r' ) && is_user_logged_in() ) {
			$args['ap_show_unpublished'] = true;
		}

		/**
		 * Filter main question list query arguments.
		 *
		 * @param array $args Wp_Query arguments.
		 */
		$args = apply_filters( 'ap_main_questions_args', $args );

		anspress()->questions = new Question_Query( $args );
		ap_get_template_part( 'archive' );
	}

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