Page 1 of 1

WordPress: Display last 4 blog posts on homepage

Posted: Tue Oct 24, 2006 7:58 pm
by IanMcGreene
I am wondering what the PHP code would be to display the last 4 blog posts on another page.

I have an existing homepage which links to the WP blog, but I want the last 4 posts to be displayed on the side of the homepage, just can't figure out the code to make this happen.

Thanks so much!

Posted: Wed Oct 25, 2006 12:08 am
by RobertGonzalez
You are going to have to either dig into the tables or find the function the_post() and grab the SQL used in it. Then set the limit on the query to 4. Bear in mind that the app does things to the date format and the categorization. If you are just wanting the posts (without all the extra stuff) you should be able to get away with a straight query.