File: //tmp/test_header.php
<?php
require_once('/var/www/sunsandholidays.com/wp-load.php');
// Simulate viewing page ID 6346
global $wp_query, $post;
$post = get_post(6346);
setup_postdata($post);
$wp_query->queried_object_id = 6346;
$wp_query->queried_object = $post;
$wp_query->is_singular = true;
$wp_query->is_page = true;
echo "hfe_header_enabled: " . (hfe_header_enabled() ? 'true' : 'false') . "\n";
echo "get_hfe_header_id: " . get_hfe_header_id() . "\n";
$header_id = Header_Footer_Elementor::get_settings('type_header', '');
echo "get_settings type_header: " . ($header_id ? $header_id : 'empty') . "\n";
$option = [
'location' => 'ehf_target_include_locations',
'exclusion' => 'ehf_target_exclude_locations',
'users' => 'ehf_target_user_roles',
];
$templates = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions('elementor-hf', $option);
echo "Templates found: " . count($templates) . "\n";
foreach ($templates as $tid => $tdata) {
echo " Template ID: $tid\n";
$type = get_post_meta($tid, 'ehf_template_type', true);
echo " Type: $type\n";
}
wp_reset_postdata();