Sorry to resurrect this post - I want to achieve the same result as the OP (albeit not just showing 1 post on the homepage) but unable to get any success. I'm no PHP expert, more of a tinkerer. So apologies in advance for fundamental errors.
In WP admin: Settings > Reading I've set front page as "Home" and posts page as "Blog". I'm editing page.php and adding the above code to the page. I'm struggling with exactly where to add it.
If start with ...
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div>
should I end with ...
<div id="content" class="narrowcolumn">
<?php
$front_page_category = get_posts( 'category=19' );
if( is_front_page() && $front_page_category ) {
foreach( $front_page_category as $post ) {
setup_postdata( $post );
/* do loop stuff here */
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
}
}
?>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div>
?
This returns an error (blank page)
Any help greatly appreciated