Plugin not working – Fatal error: Call to a member function get_forecasts()
-
Hi, please help!
I’m getting the following error displaying in place of the weather plugin on my homepage. The plugin was working until I updated to WordPress 4.4.2 but now the plugin fails 80%-90% of the time, every now and then I load the page and it works fine, but the rest of the time I see only the error message
Fatal error: Call to a member function get_forecasts() on a non-object in /home/wwwgreys/public_html/wp-content/plugins/yahoo-weather-forecasts/yahoo!-wheather.php on line 61
I have access to the site files but I am not the one who installed the plugin or setup the site originally. The cod referenced in the error is as follows. Hope you can help, thanks.
LINE 28 – 66
function yahoo_weather_simplepie( $woeid, $temperature = ‘c’, $show_credit = true ) {
if( empty( $woeid ) )
return __(‘Please provide the WOEID.’, ‘yahoo-weather’);if( function_exists(‘fetch_feed’) ) {
require_once ( ABSPATH . WPINC . ‘/class-simplepie.php’ );
require_once ( trailingslashit( YAHOO_WEATHER_DIR ) . ‘simplepie_yahoo_weather.inc’);$feed = new SimplePie();
/* specify the feed source */
$param = ‘https://weather.yahooapis.com/forecastrss?w=’ . $woeid . ‘&u=’ . $temperature;
//$param = YAHOO_WEATHER_URL . ‘forecastrss.xml’;$feed->set_feed_url( $param );
$feed->set_cache_location( YAHOO_WEATHER_DIR . ‘cache’);
$feed->set_item_class(‘SimplePie_Item_YWeather’);
// Initialize the feed
$feed->init();// Since Y! Weather feeds only have one item, we’ll base everything around that.
$weather = $feed->get_item(0);/**
* if the feed is broken, or having problem to get the feed
* and maybe there is no item in the feed then print the ‘content’
*/foreach ( $weather->get_forecasts() as $forecast ) {
$date = $forecast->get_date(‘l, F jS’);
$low = $forecast->get_low();
$high = $forecast->get_high();
$label = $forecast->get_label();
}
- The topic ‘Plugin not working – Fatal error: Call to a member function get_forecasts()’ is closed to new replies.