File: /mnt/data/dev/dev-dreamstour-wp/wp-content/themes/dreamstour/header.php
<?php
$header_style = 'default';
// Check if it's a page and has a header style set
if (is_page()) {
$page_header_style = get_post_meta(get_the_ID(), '_header_style', true);
if (!empty($page_header_style)) {
$header_style = $page_header_style;
}
}
// Get default header style from theme options
if ($header_style === 'default') {
$theme_header_style = dreamstour_fl_framework_getoptions('header_style');
if (!empty($theme_header_style)) {
$header_style = $theme_header_style;
}
}
// Define the header template parts
$header_templates = [
'style1' => 'templates/header/header-style-1',
'style2' => 'templates/header/header-style-2',
'default' => 'templates/header/header-default'
];
// Check if the selected header template exists
$template_found = false;
if (isset($header_templates[$header_style])) {
$template_path = locate_template($header_templates[$header_style] . '.php');
if (!empty($template_path)) {
get_template_part($header_templates[$header_style]);
$template_found = true;
}
}
// Fallback to default header if no template was found
if (!$template_found) {
get_template_part('templates/header/header-style-1');
}
?>