Modify Twenty Fourteen Home Page Content Limit & Add Read More Link

The twentyfourteen index page calls

get_template_part( 'content', get_post_format() );

inside the loop. So the content of the loop resides in template files with the name content-{$post_format}.php. All posts that does not have a post format uses content.php to display the post data

If you look at content.php, these lines are where the content is retrieved and displayed

<?php if ( is_search() ) : ?>
    <div class="entry-summary">
        <?php the_excerpt(); ?>
    </div><!-- .entry-summary -->
    <?php else : ?>
    <div class="entry-content">
        <?php
            the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );
            wp_link_pages( array(
                'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
                'after'       => '</div>',
                'link_before' => '<span>',
                'link_after'  => '</span>',
            ) );
        ?>
    </div><!-- .entry-content -->
    <?php endif; ?>

By default, full post content are shown on all pages, except on the search page. To display excerpts on the home page as well, you will need to modify this section of code. All you need to do is to tell wordpress that when you are on the homepage (conditional tag is_home), show excerpts instead of full content.

Simply change this line

<?php if ( is_search() ) : ?>

to

<?php if ( is_search() || is_home() ) : ?>

EDIT

Remember to make this changes in a child theme. Never make changes to the theme itself

EDIT 2

If you are using a static front page, you should use is_front_page() instead of is_home(). Go and check out how to make use of Conditional Tags. You should then try

<?php if ( is_search() || is_front_page() ) : ?>

For info on excerpts, go and check out my (almost complete) post on excerpts

Leave a Comment