WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] recent posts excerpt (3 posts)

  1. davidmarino88
    Member
    Posted 1 year ago #

    All, I would like to update my wordpress twenty eleven theme to have recent posts as excerpts instead of the current (last post as full and everything else showing only the title). Does anyone have easy code to include in the child theme?
    Thanks in advanced.

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    copy showcase.php into the child theme, add the the_excerpt() to this section:

    // For all other recent posts, just display the title and comment status.
    					while ( $recent->have_posts() ) : $recent->the_post(); ?>
    
    						<li class="entry-title">
    							<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
    <span class="recent-excerpt">
    <?php the_excerpt(); ?>
    </span>
    							<span class="comments-link">
    								<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?>
    							</span>
    						</li>
    
    					<?php
    					endwhile;

    will need some formatting using .recent-excerpt

  3. davidmarino88
    Member
    Posted 1 year ago #

    Thank you for your help. It worked. The <?php the_excerpt(); ?> was key.

Topic Closed

This topic has been closed to new replies.

About this Topic