epl_elementor_staff_query: change an Elementor Pro query with the epl_staff Query ID
Description #
Lets you change the query of an Elementor Pro widget whose Query ID is epl_staff, used to list staff from the Staff Directory extension (for example a Loop Grid of agents).
Before the action runs, EPL sets the post type to directory and marks the query with epl_elementor_context = staff. It runs while WordPress prepares the query, so change it with $query->set(). Needs Elementor Pro and the Staff Directory extension.
Part of the Elementor integration, which is in beta. See Elementor widgets and templates (beta) for how the widgets and templates fit together.
Usage #
add_action( 'epl_elementor_staff_query', 'my_function', 10, 2 );
Parameters #
$query (WP_Query)
The query about to run. Change it with $query->set().
$widget (\Elementor\Widget_Base)
The Elementor widget that owns the query.
Examples #
List staff in alphabetical order:
function my_epl_staff_by_name( $query, $widget ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
add_action( 'epl_elementor_staff_query', 'my_epl_staff_by_name', 10, 2 );
Source #
lib/page-builders/elementor/class-epl-elementor.php, in EPL_Elementor::elementor_staff_query(), hooked to elementor/query/epl_staff. Since 3.6.