How to show excerpt instead of full post in Twenty Seventeen? – WordPress Information Center

Visits: 6817

The directions at the link below were great. I am seeking employment and the employers to see how they will benefit from my vast knowledge!!!

The standard twentyseventeen WordPress theme only shows the entire article, even when you chose excerpts.

The theme editor didnt work correctly. This is what I did:

  • I made a child theme using Child Theme configurator, I selected for it to copy the current settings, so the child theme looked the same.
  • I then sshed into the server and copied the content.php file mentioned and created such a directory for the file in the new child theme dir.
  • Then I edited as suggested. You should have needed to click “read more” to get this far…

In this case, you can show excerpt instead of full post by editing the content.php file under the folder  /wp-content/themes/twentyseventeen/template-parts/post/. Of course, it’s recommended you should create a child theme before proceeding with the following change.

Please find the following code:

<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()
) );

wp_link_pages( array(
'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
'after'       => '</div>',
'link_before' => '<span class="page-number">',
'link_after'  => '</span>',
) );
?>
</div><!-- .entry-content -->

And then, replace it with the following code:

<div class="entry-content">
<?php
if ( is_single() ) :
/* translators: %s: Name of current post */
the_content( sprintf(
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
get_the_title()
) );

wp_link_pages( array(
'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
'after'       => '</div>',
'link_before' => '<span class="page-number">',
'link_after'  => '</span>',
) );
else :

the_excerpt( sprintf(
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
get_the_title()
) );

wp_link_pages( array(
'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
'after'       => '</div>',
'link_before' => '<span class="page-number">',
'link_after'  => '</span>',
) );
endif;
?>
</div><!-- .entry-content -->

Now you will see excerpt instead of the full content of posts in your front page or other archive pages.

 

Source: [WordPress] How to show excerpt instead of full post in Twenty Seventeen? – WordPress Information Center

Leave a Reply