treehouse : what would you like to learn today?
Web Design Web Development iOS Development

One more quick thing... help on the personal homepage

  • One more quick thing...

    I am getting this on my website:
    Warning: Invalid argument supplied for foreach() in /home/content/s/t/a/stacyjill/html/wp-content/themes/PersonalHomepageTheme/sidebar.php on line 25

    Does anyone know what that would be relating to?

    Here is the code that is on the page:

    <div id=\"linksidebar\">

    <div class=\"widget\">
    <div class=\"inside\">
    <img src=\"<?php bloginfo('stylesheet_directory'); ?>/images/widget-header-csstricks.png\" alt=\"CSS Tricks\" />

    <?php
    require_once('inc/simplepie.inc');

    // CHANGE THE FEED ADDRESS BELOW - THAT'S IT!
    $feed = new SimplePie('http://feeds.feedburner.com/StacyJill');

    $feed->handle_content_type();

    $total_articles = 5;

    for ($x = 0; $x < $feed->get_item_quantity($total_articles); $x++)
    {
    $first_items[] = $feed->get_item($x);
    }
    ?>

    <ul>
    <?php
    foreach ($first_items as $item)
    {
    echo '<li><a href=\"' . $item->get_link() . '\">' . $item->get_title() . '</a></li>';
    }
    ?>
    </ul>
    </div>
    </div>

    <div class=\"widget flickr\">
    <div class=\"inside\">
    <img src=\"<?php bloginfo('stylesheet_directory'); ?>/images/widget-header-myphotos.png\" alt=\"My Photos\" />

    </div>
    <div class=\"clear\"></div>
    </div>

    </div>

  • try this

    for ($x = 0; $x < $feed->get_item_quantity($total_articles); $x++)
    {
    $first_items[$x] = $feed->get_item($x); // you have to put the value into a specific column of your array
    }