0

I'd like to show a summary of my recent posts on my homepage. (Like the headlines and perhaps a few lines of text.) My site is not running on WordPress.

Is there a code snippet for that?

Edit:

When I said "widget", I didn't mean it in the WordPress sense. I meant a code snippet.

2

4 Answers 4

2

For a non-WP site, Developer's Guide - Google AJAX Feed API - Google Code is easy to use.

2
  • Um? Broken link.
    – Moshe
    Nov 24, 2010 at 22:04
  • Didn't realize that. Nov 25, 2010 at 2:18
1

There is a default widget that ships with WordPress called "Recent Posts." It displays a list of titles of your recent posts.

There are also several other similar widgets with different features, some of which might allow for a few lines of text. Try searching the Plug-in Repository for "recent posts."

3
  • How can I include this in my (non-wordpress) pages?
    – Moshe
    Nov 22, 2010 at 22:46
  • Short answer: you can't. WordPress widgets are built to be displayed in the WordPress sidebar. If you want to display a list of recent posts on a non-WordPress site, I suggest using RSS.
    – EAMann
    Nov 22, 2010 at 22:56
  • 1
    Long answer: (assuming site does use PHP) you will need to load WP core and call separately instanced copy of widget (or mess with creating whole separate sidebar for it). In this specific scenario you are indeed better using RSS as source and whatever way to display it that non-WP site has available.
    – Rarst
    Nov 24, 2010 at 6:32
1

If you want to publish a headline and excerpt of your latest posts on a non-WordPress, I'd use FeedBurner's BuzzBoost feature, it has always done the trick for me!

0

Just add the following snippet in you non-WP page:

// This is so that we can use WP functions
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');

Now you can call wp_get_recent_posts to get the latests posts.

But reading your question agin, it seems that you are NOT using Wordpress, but you want a function similar to wordpress? In that case, you're in the wrong forum. You should ask it over at StackExchange.

And if you are not using WP, then you need to fill in more details. Are you using any CMS? IS you site custom PHP? Storing data in DB? And so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.