0

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!

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.