Fatal error: Call to undefined method WP_Error::get_item_quantity()
-
Hi,
I’ve just published my website at https://www.dansportznet.com and have since been getting the following error message:
Fatal error: Call to undefined method WP_Error::get_item_quantity() in /home/danspor1/public_html/wp-content/themes/RSS Theme/home.php on line 21
Where the error is changes depending on what page you are on, but pretty much in the get_item_quality() request.
Here is a snippet of the code and where it is occurring:
<?php include_once(ABSPATH. WPINC. '/feed.php'); $afl_link = fetch_feed('https://pipes.yahoo.com/pipes/pipe.run?_id=8116da6bea0aacd7aceecaec5124dd1b&_render=rss'); $maxitems = $afl_link->get_item_quantity(20); $afl_items = $afl_link->get_items(0,$maxitems); if ($rss->get_item_quanity = 0){ echo "There are no Feeds"; } else if( is_wp_error( $feed ) ) { echo $rss->get_error_message(); // a method of WP_Error } else { $i = 0; foreach ($afl_items as $item) { ?> <?php $i++; if($i % 2 == 0) $odd_or_even = 'even'; else $odd_or_even = 'odd'; ?> <div class="post<?php echo $odd_or_even; ?>"> <p><a href="<?php echo $item->get_permalink(); ?>" target="_blank"><?php echo $item->get_title(); ?></a><p> <?php if ($enclosure = $item->get_enclosure()) { ;?> <p><?php echo $enclosure->embed();?></p> <?php } ?>
Refreshing the page sometimes resolves this issue, but obviously not a solution. Any help or advice would be greatly appreciated. This did not show up on my localhost while testing.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Fatal error: Call to undefined method WP_Error::get_item_quantity()’ is closed to new replies.