-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-featured-post.php
More file actions
45 lines (40 loc) · 1.28 KB
/
Copy pathcontent-featured-post.php
File metadata and controls
45 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Template part for displaying featured posts on the front page.
*
* Renders a single featured post as a linked thumbnail followed by the post
* categories and title. Intended to be included via get_template_part() from
* the front-page template. The thumbnail uses eager loading and a high fetch
* priority because it is typically the Largest Contentful Paint element.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
* @package Canard
*/
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<a class="post-thumbnail" href="<?php echo esc_url( (string) get_permalink() ); ?>">
<?php
the_post_thumbnail(
'canard-featured-content-thumbnail',
[
'loading' => 'eager',
'fetchpriority' => 'high',
'sizes' => '(max-width: 1300px) 100vw, 1300px',
]
);
?>
</a>
<?php endif; ?>
<header class="entry-header">
<?php
canard_entry_categories();
the_title( '<h1 class="entry-title"><a href="' . esc_url( (string) get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
?>
</header><!-- .entry-header -->
<?php get_template_part( 'entry', 'script' ); ?>
</article><!-- #post-## -->