epl_elementor_single_template_id: pick the Elementor single listing template
Description #
Chooses the EPL Single Listing template for a listing type yourself, instead of letting EPL find one. Return a template ID to use it, or 0 to let EPL choose.
When you return 0, EPL looks at published EPL Single Listing templates, newest edited first, and skips any whose author can't edit_theme_options (normally administrators), so only someone who manages the site's design can replace every listing page. A template that lists this type in Apply To Listing Types wins; otherwise the newest template with that setting left empty (all types) is used.
An ID you return is used as is: EPL doesn't check its type, status or author. Return the ID of a published EPL Single Listing template, because an ID that doesn't render leaves the listing body empty.
The result is kept per listing type for the rest of the request. epl_elementor_single_template_enabled still runs afterwards, and an Elementor Pro Theme Builder Single template that applies to the page still wins (this filter doesn't run then).
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_single_template_id', 'my_function', 10, 2 );
Parameters #
$template_id (int)
Template ID to use. Default 0 (let EPL choose).
$post_type (string)
The listing type, for example property or rental.
Examples #
Use template 456 for rural listings:
function my_epl_rural_single_template( $template_id, $post_type ) {
if ( 'rural' === $post_type ) {
return 456;
}
return $template_id;
}
add_filter( 'epl_elementor_single_template_id', 'my_epl_rural_single_template', 10, 2 );
Source #
lib/page-builders/elementor/class-epl-elementor-template-router.php, in EPL_Elementor_Template_Router::get_single_template_id(). Since 3.6.