PHP Class EP_WP_Query_Integration

Mostra file Open project: 10up/elasticpress Class Usage Examples

Public Methods

Method Description
__construct ( ) Placeholder method
action_loop_end ( $query ) Make sure the correct blog is restored
action_loop_start ( $query ) Ensure we've started a loop before we allow ourselves to change the blog
action_pre_get_posts ( $query ) Disables cache_results, adds header.
action_the_post ( array $post ) Switch to the correct site if the post site id is different than the actual one
factory ( ) : object Return a singleton instance of the current class
filter_found_posts_query ( string $sql, object $query ) : string Remove the found_rows from the SQL Query
filter_posts_request ( string $request, object $query ) : string Filter query string used for get_posts(). Query for posts and save for later.
filter_the_posts ( array $posts, &$query ) : array Filter the posts array to contain ES query results in EP_Post form. Pull previously queried posts.
setup ( ) Checks to see if we should be integrating and if so, sets up the appropriate actions and filters.

Method Details

__construct() public method

Placeholder method
Since: 0.9
public __construct ( )

action_loop_end() public method

Make sure the correct blog is restored
Since: 0.9
public action_loop_end ( $query )

action_loop_start() public method

Ensure we've started a loop before we allow ourselves to change the blog
Since: 0.9.2
public action_loop_start ( $query )

action_pre_get_posts() public method

Disables cache_results, adds header.
Since: 0.9
public action_pre_get_posts ( $query )
$query

action_the_post() public method

Switch to the correct site if the post site id is different than the actual one
Since: 0.9
public action_the_post ( array $post )
$post array

factory() public static method

Return a singleton instance of the current class
Since: 0.9
public static factory ( ) : object
return object

filter_found_posts_query() public method

Remove the found_rows from the SQL Query
Since: 0.9
public filter_found_posts_query ( string $sql, object $query ) : string
$sql string
$query object
return string

filter_posts_request() public method

Return a query that will return nothing.
Since: 0.9
public filter_posts_request ( string $request, object $query ) : string
$request string
$query object
return string

filter_the_posts() public method

Filter the posts array to contain ES query results in EP_Post form. Pull previously queried posts.
public filter_the_posts ( array $posts, &$query ) : array
$posts array
return array

setup() public method

Checks to see if we should be integrating and if so, sets up the appropriate actions and filters.
Since: 0.9
public setup ( )