Search code examples
phpjsonwordpressrssfeed

Wordpress custom rss or json feed


It is possible to make wordpress output rss or json with last 10 posts from all categories with 10 or more posts published?

Something like that or similar:

<categorie>
    <title>News</title>
    <slug>news</slug>
    <lastposts>  
        <item>
            <title>New 1</title>
            <url>http://website.com/new1</url>
            <thumb>http://website.com/thumbnail_new1.jpg</thumb>
        </item>

        <item>
            <title>New 2</title>
            <url>http://website.com/new2</url>
            <thumb>http://website.com/thumbnail_new2.jpg</thumb>
        </item>

        ...

    </lastposts>
</categorie>

<categorie>
    <title>Other</title>
    <slug>other</slug>
    <lastposts>
        <item>
            <title>Other 1</title>
            <url>http://website.com/other1</url>
            <thumb>http://website.com/thumbnail_other1.jpg</thumb>
        </item>

        <item>
            <title>Other 2</title>
            <url>http://website.com/other2</url>
            <thumb>http://website.com/thumbnail_other2.jpg</thumb>
        </item>

        ...

    </lastposts>
</categorie>

...

I've already try with http://www.example.com/?cat=42,43&feed=rss2 but it doesn't display 10 posts per categorie.

Thanks


Solution

  • Yes, you can. Try this tutorial.