Last Five Wordpress posts on site index

PHP Add comments

As you can see there is a new layout for http://pryde-design.co.uk it includes the latest 5 blog posts as well and I am going to share how I did that with you as it took me ages to work out!

At the top of your page include / require the wordpress ‘header file’ (change the path accordingly). This lets you make use of any WordPress function or template tag in the page.

PHP Code:

<?php require(‘./wordpress/wp-blog-header.php’); ?>

Add this where you want your list of last five posts

PHP Code:

<ul><?php wp_get_archives(‘type=postbypost&limit=5′); ?></ul>

Simple but it was not the way I was trying to do it so it took me ages to find it!

Andrew

Leave a Reply

WP Theme & Icons by Pryde Design
Entries RSS Comments RSS Log in