1

I want to see excerpts on my tags page (e.g., http://domain.com/wp/?tag=psychotherapy), rather than the full length post. How do I do this?

I see the following in the tags.php page for my theme:

                // Start the Loop.
                while ( have_posts() ) : the_post();

                    /*
                     * Include the post format-specific template for the content. If you want to
                     * use this in a child theme, then include a file called called content-___.php
                     * (where ___ is the post format) and that will be used instead.
                     */
                    get_template_part( 'content', get_post_format() );

                endwhile;
                // Previous/next page navigation.
                twentyfourteen_paging_nav();

Do I replace the get_template_part( 'content', get_post_format() ); line with something else, or do I have to create a content-post.php (or something like that). I do not see a content-post.php in the 2014 theme.

2

To show post excerpts on my tags page, you will need to make changes in content.php. By default content.php uses post excerpts for search pages only but you can modify the default behavior.

This is how you can include tag pages to show post excerpts. Add || is_tag() as follows:

<?php if ( is_search() || is_tag() ) : ?>
<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; ?>

If you want to use post excerpt for categories, tags and author pages then better use is_archive() instead of is_tag() in above code.

1
  • @Doug good catch. Yes it was suppose to be OR. – Robert hue Oct 18 '14 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.