Files
harpLabs_Inc/template-parts/partials/page-header.php
2024-05-03 01:55:19 -04:00

28 lines
877 B
PHP

<?php
/**
* Page header template.
*
* @package ThemeStarter
*/
$pageHeaderBG = has_post_thumbnail() ? get_the_post_thumbnail_url(get_the_ID(), 'full') : get_template_directory_uri() . '/assets/images/bgs/harplabsbg.png';
if (is_home()) {
$pageTitle = get_the_title(get_option('page_for_posts', true));
$pageHeaderBG = has_post_thumbnail() ? get_the_post_thumbnail_url(get_option('page_for_posts'), 'full') : get_template_directory_uri() . '/assets/images/bgs/harplabsbg.png';
} else if (is_archive()) {
$pageTitle = get_the_archive_title();
} else {
$pageTitle = get_the_title();
}
?>
<section class="page-header" style="background-image: url('<?= $pageHeaderBG ?>')">
<div class="max-w-7xl mx-auto flex items-center h-28 lg:h-44 py-8 px-4 xl:px-0">
<h1 class="text-2xl lg:text-4xl font-bold"><?= $pageTitle ?></h1>
</div>
</section>