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

/**
 * Blog Archive Render
 *
 * Extends base class to override blog/post archive template with Elementor layout.
 * Has custom logic to handle home, archive, search, and WooCommerce pages.
 */
final class Sifency_Addons_Blog_Archive_Render extends Sifency_Addons_Archive_Post_Render_Base {
	protected $post_type            = 'post';
	protected $canvas_path_template = 'post-type/blog/templates/sifency-archive-canvas.php';
	protected $query_var_name       = 'sifency_archive_template_id';
	protected $template_lookup_key  = 'post-archive';
	protected $hook_priority        = 99999;

	public function override_archive_template( $template ) {
		if ( ! ( is_home() || is_archive() || is_search() ) ) {
			return $template;
		}
		if ( class_exists( 'WooCommerce' ) ) {
			if ( is_shop() || is_product_taxonomy() || is_product() || is_cart() || is_checkout() || is_account_page() ) {
				return $template;
			}
		}
		return parent::override_archive_template( $template );
	}
}
