Categories::category_page()

Description #

Category page layout.

Changelog #

VersionDescription
4.1.8Added new filter ap_category_questions_args.
4.1.0Introduced.

Source #

File: addons/categories/categories.php

	public function category_page() {
		$question_args = array(
			'tax_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
				array(
					'taxonomy' => 'question_category',
					'field'    => 'id',
					'terms'    => array( get_queried_object_id() ),
				),
			),
		);

		$question_category = get_queried_object();

		if ( $question_category ) {

			/**
			 * Filter category page question list query arguments.
			 *
			 * @param array $args Wp_Query arguments.
			 * @since 4.1.8
			 */
			$question_args = apply_filters( 'ap_category_questions_args', $question_args );

			anspress()->questions = ap_get_questions( $question_args );

			/**
			 * This action can be used to show custom message before category page.
			 *
			 * @param object $question_category Current question category.
			 * @since 1.4.2
			 */
			do_action( 'ap_before_category_page', $question_category );

			include ap_get_theme_location( 'addons/category/single-category.php' );
		}
	}

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