<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function sifency_addons_render_elementor_template( $sifency_addons_template_id ) {
	if ( ! class_exists( '\Elementor\Plugin' ) ) {
		return;
	}

	if ( function_exists( 'sifency_addons_enqueue_elementor_template_assets' ) ) {
		sifency_addons_enqueue_elementor_template_assets( $sifency_addons_template_id, true );
	} else {
		\Elementor\Plugin::$instance->frontend->enqueue_styles();
		\Elementor\Plugin::$instance->frontend->enqueue_scripts();

		$css_file = \Elementor\Core\Files\CSS\Post::create( $sifency_addons_template_id );
		if ( method_exists( $css_file, 'enqueue' ) ) {
			$css_file->enqueue();
		}
	}

	echo wp_kses_post(
		\Elementor\Plugin::$instance->frontend->get_builder_content_for_display( $sifency_addons_template_id, true )
	);
}
