Customizing RSS information
-
Hi,
I want my wordpress RSS to show other information (category name) besides the default title, link etc.
Is there anyway to do this?I tried editing my wp-includes/feed-rss2.php like the following.
$cat_name = ""; $cats = get_the_category(); foreach($cats as $cat){ $cat_name .= "$cat->cat_name "; } ?> <cname><?php echo $cat_name; ?></cname>
And tried to display the value with JavaScript.
for(var i=0; i<rss.feed.entries.length; i++){ var entry = rss.feed.entries[i]; document.write(entry.title); feedHtml += '<li>'; feedHtml += '<a href="' + entry.link + '">' + entry.cname + entry.title + '</a></li>'; }
It failes, and i cant see any <cname> in my rss feeds and of course i go the undefined error when i tried to display entry.cname.
I bet i’m doing it totally wrong.
Can someone please enlighten me on how to add additional information to the RSS? (in my case, category name)
Thank you.
- The topic ‘Customizing RSS information’ is closed to new replies.