Render hero_image and hero_vector in page-hero partial; drop in-hero intro

This commit is contained in:
Keith Solomon
2026-07-01 10:29:26 -05:00
parent edf3d6c5ce
commit cda3878169
+26 -10
View File
@@ -11,7 +11,8 @@ namespace CWC;
$bgColor = get_field( 'background_color' );
$isDark = get_field( 'is_dark' );
$heading = get_field( 'heading' );
$intro = get_field( 'intro' );
$heroImage = get_field( 'hero_image' );
$heroVector = get_field( 'hero_vector' );
// Fallback for heading
if ( ! $heading ) {
@@ -24,9 +25,31 @@ if ( is_home() || is_single() || is_archive() || is_search() || is_404() ) {
}
?>
<div class="bg-cover bg-no-repeat mb-12 py-12 lg:py-16 bg-dark text-light overflow-hidden <?php echo $isDark ? 'dark' : ''; ?>" <?php echo $bgColor ? 'style="background-color: ' . esc_attr( $bgColor ) . '"' : ''; ?>>
<div class="page-hero bg-cover bg-no-repeat mb-12 py-12 lg:py-16 bg-dark text-light overflow-hidden <?php echo $isDark ? 'dark' : ''; ?>" <?php echo $bgColor ? 'style="background-color: ' . esc_attr( $bgColor ) . '"' : ''; ?>>
<div class="container mx-auto">
<?php if ( $heroImage ) : ?>
<div class="page-hero__media" aria-hidden="true">
<img
src="<?php echo esc_url( $heroImage['url'] ); ?>"
alt=""
loading="lazy"
role="presentation"
/>
</div>
<?php endif; ?>
<?php if ( $heroVector ) : ?>
<img
class="page-hero__vector"
src="<?php echo esc_url( $heroVector['url'] ); ?>"
alt=""
loading="lazy"
aria-hidden="true"
role="presentation"
/>
<?php endif; ?>
<div class="page-hero__content container mx-auto">
<div id="breadcrumbs">
<?php Breadcrumbs::render(); ?>
</div>
@@ -43,13 +66,6 @@ if ( is_home() || is_single() || is_archive() || is_search() || is_404() ) {
echo wp_kses_post( $heading );
echo '</span>';
}
// Intro
if ( $intro ) {
echo '<p class="mt-3 text-base text-light sm:mt-5 sm:text-xl lg:text-lg xl:text-xl text-center">';
echo wp_kses_post( $intro );
echo '</p>';
}
?>
</div>
</div>