[resolved] Twenty Twelve - show excerpts of posts? (3 posts)

  1. Kettercat
    Posted 2 years ago #

    Hi everyone,

    I've created a page template (under a childtheme for Twenty Twelve) that shows a list of posts under a specific category.
    Only it shows the entire posts, I want to show excerpts with links to the full post instead.

    Here's what I have -

     * Template Name: Page of Posts
     * for a child theme of Twenty_Twelve
    get_header(); ?>
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    			$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    			$args= array(
    				'category_name' => 'extra', // Change this category SLUG to suit your use; or see for query parameters http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
    				'paged' => $paged
    			if( have_posts() ) :?>
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    				<?php comments_template( '', false); ?>
    			<?php endwhile; // end of the loop. ?>
    			<?php twentytwelve_content_nav( 'nav-below' ); ?>
    			<?php else : ?>
    			<article id="post-0" class="post no-results not-found">
    				<header class="entry-header">
    					<h1 class="entry-title"><?php _e( 'No posts', 'twentytwelve' ); ?></h1>
    				<div class="entry-content">
    					<p><?php _e( 'No posts', 'twentytwelve' ); ?></p>
    					<?php get_search_form(); ?>
    				</div><!-- .entry-content -->
    			</article><!-- #post-0 -->
    			<?php endif; wp_reset_query(); ?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    What do I do?


  2. Michael
    Forum Moderator
    Posted 2 years ago #

    edit content.php in the child theme.

    and review http://wordpress.org/support/topic/show-excerpts-on-twentytwelve-childtheme-blog-page?replies=4

    use is_page_template() with the file name of your page template in the conditional; http://codex.wordpress.org/Function_Reference/is_page_template

  3. Kettercat
    Posted 2 years ago #

    Worked like a charm! Thanks a lot! :D

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.