A_Z_Listing::construct_query( $q )

Build a WP_Query object to actually fetch the posts


Description


Parameters

(Array|Object|WP_Query) (Required) Query params as an array/object or WP_Query object


Return

(WP_Query) the query


Source

File: partials/class-a-z-listing.php

	protected function construct_query() {
		/**
		 * Modify or replace the query
		 *
		 * @since 1.0.0
		 * @param WP_Query $query The query object
		 */
		$q = apply_filters( 'a_z_listing_query', $this->query );

		$query = null;

		if ( ! $q instanceof WP_Query ) {
			$q = wp_parse_args($q, array(
				'post_type' => 'page',
				'numberposts' => -1,
				'nopaging' => true,
			) );
			$query = new WP_Query( $q );
		}

		if ( ! $query instanceof WP_Query ) {
			$query = $q;
		}

		$this->query = $query;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.