WordPress.org

Ready to get started?Download WordPress

Forums

[closed] How to show a summary rather than full post? (2 posts)

  1. mrling
    Member
    Posted 1 year ago #

    Site: jakespharler.com
    Theme: child-twenty twelve

    I have been trying to show a summary of my site's post by following the instructions given by the WordPress Codex. I want my posts to automatically show as summaries on the main page. However, it does not seem to work, and I was hoping someone could help me with this? I cannot find "the_content()" tag in my index.php file, which is where most the instructions seem to say it should be. I did find it in my content.php file though, and changed it to "the_excerpt()", with no apparent effect...

    Here's two possible ways to show a summary, rather than full content of posts on a site main page:

    Use the Quicktag <!--more--> in your posts, and it will display the text of the post up to that point, and then provide a link, such as "Continue reading...", to allow the reader to see the complete post. The article, Customizing the Read More, discusses changing the text (e.g. Continue reading...) of the link.
    Change your theme's index.php Template to use the Template Tag, the_excerpt(), instead of the_content().

    http://codex.wordpress.org/FAQ_Layout_and_Design

    Here is the code for my theme's index php file:

    get_header(); ?>
    
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    		<?php if ( have_posts() ) : ?>
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    			<?php endwhile; ?>
    
    			<?php twentytwelve_content_nav( 'nav-below' ); ?>
    
    		<?php else : ?>
    
    			<article id="post-0" class="post no-results not-found">
    
    			<?php if ( current_user_can( 'edit_posts' ) ) :
    				// Show a different message to a logged-in user who can add posts.
    			?>
    				<header class="entry-header">
    					<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
    				</header>
    
    				<div class="entry-content">
    					<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
    				</div><!-- .entry-content -->
    
    			<?php else :
    				// Show the default message to everyone else.
    			?>
    				<header class="entry-header">
    					<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
    				</header>
    
    				<div class="entry-content">
    					<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
    					<?php get_search_form(); ?>
    				</div><!-- .entry-content -->
    			<?php endif; // end current_user_can() check ?>
    
    			</article><!-- #post-0 -->
    
    		<?php endif; // end have_posts() check ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Please continue in your existing thread on this subject - http://wordpress.org/support/topic/how-to-add-an-excerpt?replies=4

Topic Closed

This topic has been closed to new replies.

About this Topic