Reputation: 477
Is there any member function available in SimplePie to get the Category (Labels) of a post ?
Upvotes: 1
Views: 790
Reputation: 17205
In addition to superUntitled's answer
$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();
}
}
NB: it is also the same for term and scheme:
echo $category->get_term();
echo $category->get_scheme();
from simplepie documentation:
Upvotes: 1
Reputation: 22527
You will need to use the get_categories() function...
foreach ($item->get_categories() as $category)
{
echo $category->get_label();
}
Upvotes: 1