fetch_rss() isn’t working
-
I’m using the code exactly as it says to here. and this is the warning i’m getting:
Warning: array_slice() [function.array-slice]: The first argument should be an array in /home/*****/blog/wp-content/themes/yellowhiteflower/yellowhiteflower/sidebar.php on line 23 * No items
I have no idea how to fix this and I can’t find a plugin to work with this either, nor more info on google. I’m truly stuck here folks – any help would be soooo appreciated.
This is the code I’m using (from above codex page)
<h2><?php _e('New at SAGF'); ?></h2> <?php // Get RSS Feed(s) include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss('https://strawberriesareglutenfree.com/feed/'); $maxitems = 5; $items = array_slice($rss->items, 0, $maxitems); ?> <ul> <?php if (empty($items)) echo '<li>No items</li>'; else foreach ( $items as $item ) : ?> <li><a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'> <?php echo $item['title']; ?> </a></li> <?php endforeach; ?> </ul>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘fetch_rss() isn’t working’ is closed to new replies.