Site icon Hip-Hop Website Design and Development

The best way to change Elementor Template for Single Web page Publish on Load

I really want your assist with the next situation.

I’ve a customized Publish Sort Created. For this Publish Sort I’ve 2 elementor Single submit templates:
It seems like this:
[elementor-template id="1890"] – Identify: Record CEO view
[elementor-template id="3556"] – identify: Record Different folks view

I wish to do is that typically I must load the identical submit utilizing the second template. The difficulty is that elementor solely let you have got one template per submit kind.

I attempted to make use of php to alter the template on load like beneath. First, I added a parameter within the URL (motion=otherpeople) that I exploit as set off after I wish to load the second template.

operate prefix_template_mods( $template ) {

// Test if our GET parameter exists and holds a selected worth
if( isset( $_GET['action'] ) && 'otherpeople' == $_GET['action'] ) {
    
            
    // Try and find our template
    $new_template = locate_template( array( '??????otherpeople.php?????' ) );
    
    // If a template was discovered, change it
    if( ! empty( $new_template ) ) {
        $template = $new_template;
    }
    
}

return $template;

}
add_filter( ‘template_include’, ‘prefix_template_mods’ );

My drawback is that I do not know find out how to discover the opposite elementor template that I wish to use and I do not know find out how to write the php code for this.
If I’m going in elementor and I change the default template for that submit kind, after all it really works.
I do know that that is potential in WordPress to modify the template on load on this context with elementor, as this template will not be listed should you create a brand new submit for instance.

Thanks very a lot.