Thanks, I’ll check it out.
Ok. So I’ve created the static front page and my blog page as the tutorial states and everything is fine except how do I get the most recent post to show on my newly created ‘static’ front page called home?
Ok, am I just brain dead today or what. When you create a static front page, this page is created in the admin and therefore a stored page in the database. There is no actual file for this page and so my question to you is where do I place this code?
Create a custom page template for your Home page and add the get_posts loop to that page.
http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates
You could add the get_posts block to your default page.php template file and surround it with a conditional so it only runs on the front page. But the custom template approach is a bit safer in that you can always revert to the default page template if your code goes pear-shaped. Which happens to everyone at least some of time. 🙂
This is the code i use to pull the most recent Post onto my static front page and this is on a page template i created called : Main-
‘
<?php $temp_query = $wp_query; ?>
<?php query_posts(‘&showposts=1’); ?>
<?php while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h3>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
‘
Ok, I have it working now. However, since I’ve created the static front page http://www.domain.com/ does not resolve to is as it’s now at http://www.domain.com/home and the rewrite rules that WP presented do not cover this.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Do you have a home.php file in your current theme? If so, try renaming it and set up a static front page following the normal route.
http://quirm.net/2009/06/12/setting-up-a-static-wordpress-home-page/