Display Posts Outside WordPress – SEO Video
Hello and welcome this weeks SEO Video Blog, one of our most popular posts on Creare SEO is ‘PHP RSS aggregators‘, This looks at 3 methods of displaying a RSS feed on your site, these were Magpie RSS, Simple Pie RSS and RSS Aggregator.
With a lot of webmasters now using wordpress, we thought we would show how to aggregate your posts onto a normal PHP web page outside your wordpress folder in a much easier fashion.
Having links to your blog your main site can be great in helping your blogs SEO performance and indexing of your blog pages, so using some simple PHP we are going to show you how to extract the information you need.
<screen shot>
<ul>
<?php require($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-load.php'); query_posts('showposts=3'); if (have_posts()) : while (have_posts()) : the_post(); ?>
<li>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span>Posted on <?php the_time('l jS F, Y') ?></span><br />
<?php the_excerpt(); ?>
</li>
<?php endwhile; else: echo "no posts"; endif; ?>
<?php wp_reset_query(); ?>
</ul>
To install the code simply:
- Copy and Paste the code from the blog onto your non-wordpress page (must be PHP).
- Rename the /wordpress/ folder to your folder installation name ie. blog or news
- Edit the amount of posts you wish to display.
- That’s it – Ready to roll….
You can make further adjustments to the code such as only display particular categories.
To do so:
- Identify your category ID.
- Modify line 2 of the script. (See screen shot)
<?php require($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-load.php'); query_posts('cat=8&showposts=3'); if (have_posts()) : while (have_posts()) : the_post(); ?>
<screen shot 2>
And also, you can add in a thumbnail by adding in the following code.
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<screen shot 3>
Thank for watching this week, any questions or comments please leave them on the supporting blog post.

April 13th, 2012
Will implement this in my blog. Very good!