Quantcast
Channel: Frank Verhoeven » PHP
Viewing all articles
Browse latest Browse all 5

Create an RSS Feed with WordPress

$
0
0

When you are busy creating a wonderful plugin for your WordPress blog, it might be possible that you need to create a RSS feed. For example, when creating a guestbook people could ask for a RSS feed to view the recent added posts and stay updated, or take a look at my own Community News Plugin, isn’t it great if it had a build-in RSS feed as well?

Well don’t worry I am busy to create that and it is almost finished. In the mean while, I wanted to share some stuff I learned while creating this RSS feed.

The Beginning

The first thing we need is a function that actually creates the RSS feed. This function doesn’t need any parameters and it also shouldn’t return anything.

{code type=php}
function myGreatPluginRSSFeed() {
// Function content goes here.
}
?>
{/code}

This function must create the whole feed form the beginning to the end. So, you also have to include the xml/rss header. I ripped something from the default WordPress feed that should work for any blog.

{code type=php}
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images