Quantcast
Channel: echo category in rss feed - Stack Overflow
Viewing all articles
Browse latest Browse all 2

echo category in rss feed

$
0
0

I am pulling an rss feed into my page templates using the default /feed.php. I can echo out the title, permalink and description just fine, but I can't seem to get the categories to display. Ideally I would like to use the category to insert a background image into a div by class.This is what I have:

<?php if(function_exists('fetch_feed')) {include_once(ABSPATH . WPINC . '/feed.php');  $feed = fetch_feed('http://www.*link to the feed*'); $limit = $feed->get_item_quantity(50); $items = $feed->get_items(0, $limit); }if ($limit == 0) echo 'The feed is either empty or unavailable.';else foreach ($items as $item) : ?><div class="feedItem"><div class="<?php echo $item->get_categories(); ?>"></div><ul><li class="feedtitle"><a href="<?php echo $item->get_permalink(); ?>"target="_blank"> <?php echo $item->get_title(); ?></a> </li><li class="feeddate"><?php echo $item->get_date('m/d/y'); ?></li><li><p><?php echo($item->get_description()); ?></p></li></ul>   </div><!--item--><?php endforeach; ?>

But the <?php echo $item->get_categories(); ?> only echos out <div class="Array"></div>

How do I get the names of the categories from the rss feed?

Any help is appreciated.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images