biofriction-wp-theme/template-parts/featured-image.php

11 lines
670 B
PHP
Raw Permalink Normal View History

2021-02-18 15:27:46 +01:00
<?php
// If a featured image is set, insert into layout and use Interchange
// to select the optimal image size per named media query.
if ( has_post_thumbnail( $post->ID ) ) : ?>
<header class="featured-hero" role="banner" data-interchange="[<?php the_post_thumbnail_url( 'featured-small' ); ?>, small], [<?php the_post_thumbnail_url( 'featured-medium' ); ?>, medium], [<?php the_post_thumbnail_url( 'featured-large' ); ?>, large], [<?php the_post_thumbnail_url( 'featured-xlarge' ); ?>, xlarge]">
</header>
<?php else :?>
<header class="featured-hero" role="banner" style="background-image: url('<?php echo catch_post_first_image();?> ');">
</header>
<?php endif;