Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit 60f7311

Browse files
committed
Add support for post formats in single post
1 parent 5e507c2 commit 60f7311

3 files changed

Lines changed: 6 additions & 37 deletions

File tree

single.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<?php
1616
while ( have_posts() ) : the_post();
1717

18-
get_template_part( 'template-parts/content', 'single' );
18+
get_template_part( 'template-parts/content', get_post_format() );
1919

2020
the_post_navigation();
2121

template-parts/content-single.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

template-parts/content.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
1313
<header class="entry-header">
1414
<?php
15-
the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
15+
if ( is_single() ) {
16+
the_title( '<h1 class="entry-title">', '</h1>' );
17+
} else {
18+
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
19+
}
1620

1721
if ( 'post' === get_post_type() ) : ?>
1822
<div class="entry-meta">

0 commit comments

Comments
 (0)