<?php

/**
 * The template for displaying pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages and that
 * other "pages" on your WordPress site will use a different template.
 *
 * @package kardealer
 * @subpackage Kar_dealer
 * @since car dealer 1.0
 */



// 2024
// Verificar se HTTP_HOST está definido e capturar
$server_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';

//die(var_export($server_host));
//
//


if ($server_host === 'wordpress.org') {
	$image_url = get_template_directory_uri() . '/kardealer.jpg'; // Verifique se a imagem existe no diretório correto

	// Define o conteúdo da nova página com o link e a imagem
	$homepage_content = '<a href="https://kardealertheme.com" target="_blank">Click to Visit Our Demo Site</a><br><br>';
	$homepage_content .= '<img src="' . esc_url($image_url) . '" alt="">';

	get_header();
?>
	<main id="main" class="site-main" role="main">
		<div class="homepage-content">
			<?php echo $homepage_content; ?>
		</div>
	</main><!-- .site-main -->
<?php
	get_footer();
	exit; // Para garantir que o restante do código não seja executado
}





get_header(); ?>

<div id="primary" class="content-area">
	<main id="main" class="site-main" role="main">
		<?php
		// Start the loop.
		while (have_posts()) : the_post();

			// Include the page content template.
			get_template_part('template-parts/content', 'page');

			// If comments are open or we have at least one comment, load up the comment template.
			if (comments_open() || get_comments_number()) {
				comments_template();
			}

		// End of the loop.
		endwhile;
		?>

	</main><!-- .site-main -->

	<?php get_sidebar('content-bottom'); ?>

</div><!-- .content-area -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>