How to show excepts in front page of site
-
Hi, I am currently using Suits theme for my blog. This theme only shows excerpts for the search page. I want excerpts to show on the front page of my blog too.
My content.php looks like this:
<?php /** * The default template for displaying content. Used for both single and index/archive/search. * * @package Suits * @since Suits 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?> <div class="entry-thumbnail"> <?php the_post_thumbnail(); ?> </div> <?php endif; ?> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else : ?> <h1 class="entry-title"> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h1> <?php endif; // is_single() ?> </header><!-- .entry-header --> <?php if ( is_search() ) : // Only display Excerpts for 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">→</span>', 'suits' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'suits' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?> </div><!-- .entry-content --> <?php endif; ?> <footer class="entry-meta"> <?php suits_entry_meta(); ?> <?php if ( comments_open() ) : ?> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'suits' ) . '</span>', __( '1 Comment', 'suits' ), __( '% Comments', 'suits' ) ); ?> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'suits' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
I tried editing <?php the_content> to <?php the_excerpt>, and the front page will show the excerpt, but when I click to view a particular post, it will show the excerpt only (not the full post).
Also, I want to include a <read more> link after the excerpt of each post. Can someone help me to suggest edits to these codes? Thanks so much! 😀
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to show excepts in front page of site’ is closed to new replies.