v2.2 upgrade causes rss_fetch error (foreach)
I upgraded from v2.1 to 2.2, and now have the following error:
Warning: Invalid argument supplied for foreach() in /home/mysite1/public_html/blog/wp-content/themes/rc2005-850/sidebar.php on line 46
I recall simply copying and modifying the code from http://codex.wordpress.org/Function_Reference/fetch_rss to get this to work. The code looked like:
<h2>Recently on my other blog</h2> <?php require_once(ABSPATH . WPINC . '/rss-functions.php'); ?> <?php $rss = fetch_rss('http://mysite2.com/blog/index.php/feed/'); ?> <ul> <?php foreach ( $rss->items as $item ) : ?> <li><a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'> <?php echo $item['title']; ?> </a></li> <?php endforeach; ?> </ul>
I note that the current example at http://codex.wordpress.org/Function_Reference/fetch_rss refers to rss.php rather than rss-functions.php . I’ve otherwise been trying small variations, but I’m not a natural PHP coder, so I might be missing something easy.
- The topic ‘v2.2 upgrade causes rss_fetch error (foreach)’ is closed to new replies.