Excerpt on alt Blog
-
So I recently implemented a template called Page-Of-Posts Template for Twenty Twelve that I got from http://www.transformationpowertools.com/wordpress/page-of-posts-template-for-twenty-twelve and now I am working on getting it customized. One thing left to do is have it so the posts only show the excerpt. I know that one way to do this is in content.php but this would change my main blog page as well and I only want it done on my custom blog page. I did find this codex that I think is what I need:
Access all post data
Some post-related data is not available to get_posts by default, such as post content through the_content(), or the numeric ID. This is resolved by calling an internal function setup_postdata(), with the $post array as its argument:<?php $args = array( 'posts_per_page' => 3 ); $lastposts = get_posts( $args ); foreach ( $lastposts as $post ) : setup_postdata( $post ); ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_content(); ?> <?php endforeach; wp_reset_postdata(); ?>The line with <?php the_content(); ?> when changed to the_excerpt from content.php will only show the excerpts. So I was wondering how I might implement this on my page?
The topic ‘Excerpt on alt Blog’ is closed to new replies.