2019.05.13(pm): How do I represent the summary of post on Twenty Seventeen Theme?

In the WordPress Twenty Seventeen theme, when you view the list of posts, the entire contents are displayed. Let’s see how to turn this into a summary display.

After moving to the WordPress dash board, go into the theme design and enter Theme Editor. After entering the CSS editor, look for content.php

<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 -->

Replace the above code with the code below.

<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 -->

Save and redirect your homepage again, you will see a summary.

Leave a Reply

Your email address will not be published. Required fields are marked *