开发者

Wired problem using fetch_feed function and using array of feed urls

i am merging couple of rss feed from user profile in wordress where the rss feed urls user inputs one in every line. I am using implode function to make array with the rss feeds the using wordpress fetch_feed function to retrieving posts. But for some wired reason posts from one url is not showing. But when i create an array with same urls manually it works! Here is 开发者_高级运维the code you can see it yourself.

//array by explode
if($author->feeds){
                 $urlArray = explode("\r", $author->feeds);
             }
//manually created array     
    $mArray = array('http://lakeview.citystirchicago.com/feed/', 'http://citystir.com/feed/');

down in the page

     if($author->feeds){
                        if(function_exists('fetch_feed')){
                            include_once(ABSPATH . WPINC . '/feed.php');
                            $feed = fetch_feed($array);
                            if (!is_wp_error( $feed ) ){
                                $limit = $feed->get_item_quantity(8);
                                $items = $feed->get_items(0, $limit);
                                if(!$items){
                                    echo 'Problem loading feed.';
                                } else {
                                    ?>
                                    <ul id="activity_feed">
<?php
foreach ($items as $item):
//do stuff
endforeach;
?>

You can check two instance via this two urls. I have printed the $mArray and $urlArray both. The array created manually $mArray shows the posts from the second link (New test post) while array by explode $urlArray is not Both are same but result is different!:

Using $mArray: http://citystir.com/author/designdons/

Using $urlArray: http://citystir.com/author/designdons/?test=1


Resolved: had to change the explode delimiter "\r" to "\r\n". I might have to find more efficient way to explode. Thanks!


Changing the explode delimiter "\r" to "\r\n" solved the issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜