You are here: Documentation » API Reference » SimplePie_Item » get_category()
Table of Contents
get_category()
Description
class SimplePie_Item { get_category ( [int $key = 0] ) }
Returns a single array location containing a SimplePie_Category object.
Availability
- Available since SimplePie Beta 3.
- Previously existed as
get_categories()
since SimplePie Beta 2.
Parameters
key
The item that you want to return. Remember that arrays begin with 0
, not 1
.
Examples
Loop through each item and do something with each
$feed = new SimplePie(); $feed->set_feed_url('http://simplepie.org/blog/feed/'); $feed->init(); $feed->handle_content_type(); foreach ($feed->get_items() as $item) { if ($category = $item->get_category()) { echo $category->get_label(); } }
See Also
reference/simplepie_item/get_category.txt · Last modified: 2011/03/06 03:56 (external edit)