title: Wordpress theme fatal error "Fatal error: Call to undefined method WP_Error::get_items()"
body: <p>One of my Wordpress themes is showing the following error:</p>
  
  <pre><code>Fatal error: Call to undefined method WP_Error::get_items() in /home1/mywebsite/public_html/learnphp123.com/wp-content/themes/econews/admin/IDE_admin.php on line 88
  </code></pre>
  
  <p>The code for the file is (you can see "get_items()" on line 88 .... actually the third line in the code):</p>
  
  <pre><code>    if($feed) {
                  $html = '&lt;ul&gt;';
                  foreach ($feed-&gt;get_items() as $item){
                      $html.="&lt;li&gt;&lt;span&gt;".$item-&gt;get_date('d M Y')."&lt;/span&gt; &lt;a href=\"".$item-&gt;get_permalink()."\"&gt;".$item-&gt;get_title()."&lt;/a&gt;&lt;/li&gt;";
                  }    
  </code></pre>
  
  <p>Can anybody tell me what to use in the place of <code>"get_items()"</code>?</p>
  
  <p>Thank you very much for your help!
  The total code of the file is given below and I am only getting the error on line 88 related to feed get_items ().</p>
  
  <pre><code>    &lt;?php
  
  /*
      Copyright 2010, idesigneco.com
      http://idesigneco.com
  */
  
  define('IDE_ADMIN_FEED', 'http://idesigneco.com/wp_pub.php?id=ide_admin_newsfeed.xml&amp;theme='.IDE_CODE.'&amp;ver='.IDE_VERSION);
  
  // load form generator and validator
  include IDE_ADMIN_PATH.'IDE_FormGenerator.class.php';
  
  // initialize the admin form
  $Form = new IDE_FormGenerator(array(
      'name' =&gt; 'admin',
      'method' =&gt; 'post',
      'action' =&gt; ''
  ));
  
  // setup the form fields
  $Form-&gt;elements(
      null,
      array(
          'admin_action' =&gt; array(
              'type' =&gt; 'hidden', 'value' =&gt; 'admin',
              'error' =&gt; 'Your settings have been updated.'
          )
      )
  );
  
  // load theme specific options
  include IDE_ADMIN_PATH.'/IDE_admin_options.php';
  
  $Form-&gt;elements(
      null,
      array(
          'submit' =&gt; array(
              'type' =&gt; 'submit', 'value' =&gt; 'Save', 'label' =&gt; ''
          ),
      )
  );
  
  $Form-&gt;printErrors(true);
  
  
  // ________________________________________________________
  
  // process the form data
  if(!empty($_POST['admin_action'])) {
  
      // unchecked checkbox options don't show up, so fill them with predefined key names
      ide_save_options( array_merge( array_fill_keys($IDE_checkboxes, ''),
                                     stripslashes_deep($_POST)
                                    )
                      );
      $Form-&gt;setErrors(array('admin_action'));
  }
  
  // ________________________________________________________
  
  // populate the form with saved options
  $Form-&gt;data($IDE_options);
  
  // ________________________________________________________
  
  
  // print out the admin area
  ide_admin_header();
  $Form-&gt;generate();
  ide_admin_footer();
  
  // ________________________________________________________
  
  // idesigneco news feed
  function ide_admin_news() {
  
      $time = ide_option('admin_newsfeed_time');
      $html =  ide_option('admin_newsfeed');
  
  
      // feed expired, update
      if(!$html || !$time || ($time+(5*3600)) &lt; time() ) {
          if(function_exists('fetch_feed')){
              $feed = fetch_feed(IDE_ADMIN_FEED);
  
              if($feed) {
                  $html = '&lt;ul&gt;';
                  foreach ($feed-&gt;get_items() as $item){
                      $html.="&lt;li&gt;&lt;span&gt;".$item-&gt;get_date('d M Y')."&lt;/span&gt; &lt;a href=\"".$item-&gt;get_permalink()."\"&gt;".$item-&gt;get_title()."&lt;/a&gt;&lt;/li&gt;";
                  }
                  $html.= '&lt;/ul&gt;';
              } else {
                  $html = 'Updates unavailable at this time';
              }
          } else {
              // deprecated feed api
              if(function_exists('fetch_rss')){
                  include_once(ABSPATH . WPINC . '/rss.php');
                  $rss = fetch_rss(IDE_ADMIN_FEED);
                  $html = '&lt;ul&gt;';
                  foreach ($rss-&gt;items as $item){
                      $html.="&lt;li&gt;&lt;span&gt;".date('d M Y', strtotime($item['pubdate']))."&lt;/span&gt; &lt;a href=\"".$item['link']."\"&gt;".$item['title']."&lt;/a&gt;&lt;/li&gt;";
                  }
                  $html.= '&lt;/ul&gt;';
              }
          }
  
          ide_save_option('admin_newsfeed_time', time());
          ide_save_option('admin_newsfeed', $html);
      }
  
  
      echo $html;
  }
  
  
  // admin header
  function ide_admin_header() {
      ?&gt;
      &lt;div id="ide_admin"&gt;
          &lt;div class="left"&gt;
          &lt;h1 class="ide_title"&gt;&lt;?php echo IDE_NAME.' '.IDE_VERSION; ?&gt;&lt;/h1&gt;
          &lt;div class="clear"&gt; &lt;/div&gt;
      &lt;?php
  }
  
  // admin footer
  function ide_admin_footer() {
      ?&gt;
          &lt;/div&gt;&lt;!-- left //--&gt;
  
          &lt;div class="right"&gt;
              &lt;div class="idesigneco"&gt;
                  &lt;a href="http://idesigneco.com"&gt;&lt;img src="&lt;?php echo IDE_ADMIN_STATIC.'/idesigneco.png'; ?&gt;" alt="Theme by iDesignEco" title="Theme by iDesignEco" /&gt;&lt;/a&gt;
              &lt;/div&gt;
              &lt;div class="news"&gt;
                  &lt;h2&gt;iDesignEco Updates&lt;/h2&gt;
                  &lt;?php ide_admin_news(); ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;&lt;!-- right //--&gt;
          &lt;div class="clear"&gt; &lt;/div&gt;
  
      &lt;/div&gt;&lt;!-- ide_admin //--&gt;
      &lt;?php
  }
  </code></pre>
  
  <p>?></p>