<?php
if ( ! defined( 'ABSPATH' ) ) exit;
/**
 * Sifency Blank Canvas Template for Elementor Archive Page
 */
$sifency_addons_template_id = get_query_var( 'sifency_archive_template_id' );
get_header();
echo '<div class="sifency-blog-elementor-archive">';
if ( ! empty( $sifency_addons_template_id ) && class_exists( '\Elementor\Plugin' ) ) {
    echo '<!-- Rendering Elementor Archive Template ID: ' . esc_html( $sifency_addons_template_id ) . ' -->';
    $sifency_addons_frontend = \Elementor\Plugin::$instance->frontend;
    add_action( 'wp_enqueue_scripts', function() use ( $sifency_addons_template_id, $sifency_addons_frontend ) {
        $sifency_addons_frontend->enqueue_styles();
        $sifency_addons_frontend->enqueue_scripts();

        if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) {
            $css_file = \Elementor\Core\Files\CSS\Post::create( $sifency_addons_template_id );
            if ( method_exists( $css_file, 'enqueue' ) ) {
                $css_file->enqueue();
            }
        }
    }, 20 );
    
    echo wp_kses_post(
        $sifency_addons_frontend->get_builder_content_for_display( $sifency_addons_template_id, true )
    );

}
echo '</div>';
get_footer();
