I'm building a site which uses WP as a CMS. The homepage needs to merely display one paragraph of text and pull three of the latest blog headlines. Then there will be a separate page called 'blog' which functions as usual. For this, I've created a 'blog.php' template.
*I realize WP2.1+ allows you to configure your homepage as a flat page and display your blog elsewhere (Options->Reading), but I'd like to avoid any extra configuration steps.*
Anyway, I copied over the standard Loop code from 'index.php' to 'blog.php' then saved it, but it doesn't seem to work. So I added a query_posts function -- now it displays some posts, but when you click "Previous Posts" at the bottom, it doesn't pull from the archive, it simply repeats the posts. Can anyone help with this code?
<?php /* Template Name: blog */ ?> <?php get_header(); ?> <div id="content"> <?php query_posts(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <p class="postmetadata">Posted by <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y') ?> | Categorized as <?php the_category(', ') ?> | Tagged as <?php the_tags(''); ?> | <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> </p> <div class="entry"> <?php the_content('Read the rest of this entry »'); ?> </div> </div> <?php endwhile; ?> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>