Last active
April 19, 2019 11:53
-
-
Save westonruter/b924a2c6aaa746a477053472e06fc557 to your computer and use it in GitHub Desktop.
Twenty Seventeen: Force content excerpts on archives.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template part for displaying a post, forcing the excerpt template part to be used on archives. | |
* | |
* Instructions: Place this file in your twentyseventeen child theme at template-parts/post/content.php | |
* | |
* @package Twenty_Seventeen | |
*/ | |
if ( is_archive() ) { | |
get_template_part( 'template-parts/post/content', 'excerpt' ); | |
} else { | |
include get_template_directory() . 'template-parts/post/content.php'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This no longer works, as of April 2019 (probably earlier).
My solution is to modify /template-parts/post/content.php as follows (from line 53):
<?php if ( is_single() ) { ?> <div class="entry-content"> <?php /* translators: %s: Name of current post */ the_content( sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), get_the_title() ) ); } else { ?> <div class="entry-excerpt"> <?php the_excerpt(); }
The above snippet comes directly above
wp_link_pages(
and replaces the existing content beginning<div class="entry-content">
.