epl_elementor_listing_agents: the agents the Agents widget shows

Description #

Filters the list of agents for a listing, used by the Elementor Agents widget. EPL looks up the agent at each of the four positions (see epl_elementor_agent_id), skips empty positions and repeats, and passes the list here. The widget then shows up to its own agent count setting.

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_filter( 'epl_elementor_listing_agents', 'my_function', 10, 2 );

Parameters #

$agents (EPL_Author_Loader[])
The agents, in position order. Each has an author_id.

$property (EPL_Property_Meta)
The listing.


Examples #

Leave the office account (user 12) out of the Agents widget:

function my_epl_hide_office_agent( $agents, $property ) {
	$agents = array_filter(
		$agents,
		function ( $agent ) {
			return 12 !== (int) $agent->author_id;
		}
	);
	return array_values( $agents );
}
add_filter( 'epl_elementor_listing_agents', 'my_epl_hide_office_agent', 10, 2 );

Source #

lib/page-builders/elementor/class-epl-elementor.php, in EPL_Elementor::get_listing_agents(). Since 3.6.