first theme commit
This commit is contained in:
28
template-parts/partials/page-header.php
Normal file
28
template-parts/partials/page-header.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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>
|
Reference in New Issue
Block a user