如何从wordpress post feed获取帖子标签

时间:2014-10-01 11:51:06

标签: php wordpress

以下是我在php中从wordpress feed url获取Feed的代码:

$weburl='http://kaleidicopub.wpengine.com/category/kaleidico/feed/';
$rss = new DOMDocument();
$rss->load($weburl);
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
    $item = array ( 
        'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
        'content' => $node->getElementsByTagName('encoded')->item(0)->nodeValue,
        'author' => $node->getElementsByTagName('creator')->item(0)->nodeValue,
        'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
        'category' => $node->getElementsByTagName('category')->item(0)->nodeValue,
        'tag' => $node->getElementsByTagName('tag')->item(0)->nodeValue,
    );
    array_push($feed, $item);
}

如何从中获取帖子标签?我可以获得类别但无法获得帖子标签。请帮帮我。

0 个答案:

没有答案