<?php
if ( ! defined( 'ABSPATH' ) ) exit;
final class Sifency_Career_Archive_Render {
    public function __construct() {
        if ( is_admin() ) return;
        add_filter( 'template_include', [ $this, 'override_career_archive_template' ], 999 );
    }
    public function override_career_archive_template( $template ) {
        if ( ! is_post_type_archive( 'career' ) ) {
            return $template;
        }
        remove_filter('template_include', [ Sifency_Addons_Theme_Builder_Master::$sifency_addons_frontend_render, 'load_canvas_template' ], 999);
        $canvas_path = SIFENCY_TB_PATH . 'post-type/career/templates/sifency-career-archive-canvas.php';
        if ( ! file_exists( $canvas_path ) ) {
            return $template;
        }
        $sifency_addons_template_id = Sifency_Frontend_Helper::find_matching_template( 'career-archive' );
        set_query_var( 'sifency_career_archive_template_id', $sifency_addons_template_id );
        return $canvas_path;
        
    }
}