Support » Theme: Twenty Fifteen » Help with getting post excerpts on home page

  • I have full posts on the home page and am trying to change to excerpts with a link to full post. I can’t seem to make this happen. I’ve tried the excerpt settings for each post and Dashboard->Settings->Reading setting for “Summary”.

    I’ve tried on existing post and new posts and have emptied page cache.

    I’m sure I’m missing something. Help appreciated.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, you would need to create a child theme first before making any changes to the theme files:

    https://developer.wordpress.org/themes/advanced-topics/child-themes/

    That way, any changes you make won’t be overridden if the theme updates in the future. Once you have the child theme created, you’ll want to copy /wp-content/themes/twentyfifteen/content.php into the child theme. Once you have that file open look for the following code

    /* translators: %s: Name of current post */
    			the_content(
    				sprintf(
    					__( 'Continue reading %s', 'twentyfifteen' ),
    					the_title( '<span class="screen-reader-text">', '</span>', false )
    				)
    			);

    and replace it with this code

    if ( is_home() ) :
    				the_excerpt();
    			else :
    			/* translators: %s: Name of current post */
    			the_content(
    				sprintf(
    					__( 'Continue reading %s', 'twentyfifteen' ),
    					the_title( '<span class="screen-reader-text">', '</span>', false )
    				)
    			);
    			endif;

    Save the file, activate the child theme and you’ll see the post excerpts on the homepage of the site with a link to read the full post.

    Whew! I took a stab at creating child theme. Some straightforward, some over my head. I’ll keep working at understanding things as it will serve me well going forward.

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.