Problem with RSS feeds. array_alice error
-
I have a strange problem with pulling in RSS entries from a feed. Most of the times I get this error on the page, but after reloading, it works. Obviously, the best thing would be for it never to show the error and just reload automatically when there was a problem.
This is the error code i get in the browser:
Warning: array_slice() expects parameter 1 to be array, null given in /home3/kasperso/public_html/wp-content/themes/mechatronics/page_media.php on line 14
Here are the lines 11-18 in the file page_media.php
<?php include_once(ABSPATH.WPINC.'/rss.php'); // path to include script $feed = fetch_rss('https://pipes.yahoo.com/pipes/pipe.run?_id=e49a6cfb219f8180ded1313941be1808&_render=rss'); // specify feed url $items = array_slice($feed->items, 0, 5); // specify first and last item ?> <?php if (!empty($items)) : ?> <?php foreach ($items as $item) : ?> <div class="post"> <h1 class="post-title"><a>"><?php echo $item['title']; ?></a><?php edit_post_link(' EDIT', '<span>', '</span>'); ?></h1> <?php if (isset($item['description'])) : ?> <div class="entry"><?php echo $item['description']; ?></div> <?php endif; ?> </div> <?php endforeach; ?> <?php endif; ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Problem with RSS feeds. array_alice error’ is closed to new replies.