致命错误:无法在/opt/lampp/htdocs/news/WP content/plugins/iron\\u elements/vc\\u extend/shortcode/wwn\\u business\\u feed中将WP\\u error类型的对象用作数组。php第13行
<?php
if ( !function_exists(\'wwn_currency_updates\')):
function wwn_currency_updates($atts) {
ob_start();
$attr = shortcode_atts(array(\'currency\' => esc_html__(\'USD\', \'worldwidenews\'),
\'css\' => esc_html__(\'\', \'worldwidenews\'),
), $atts);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class($attr[\'css\'], \' \'), \'wwn_currency_updates\', $atts);
$currency_base = $attr[\'currency\'];
$current_ping = "http://api.fixer.io/latest?base=" . $currency_base;
$currency = wp_remote_get($current_ping);
if ($currency) {
$currency_data = json_decode($currency[\'body\']); ?>
<div class="<?php echo esc_attr($css_class); ?>">
<div class="wwn-currency-update-wrapper">
<div class="sub-heading-sec">
<h6><?php esc_html_e(\'Currency Rates\', \'worldwidenews\'); ?></h6>
</div><!--sub-heading-sec-->
<div class="wwn-currency-rates-sec">
<ul class="wwn-currency-rates-info">
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - AUD (Australian Dollars)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->AUD) ? esc_html($currency_data->rates->AUD) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - CAD (Canadian Dollar)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->CAD) ? esc_html($currency_data->rates->CAD) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - EUR (Euro)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->EUR) ? esc_html($currency_data->rates->EUR) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - NZD (New Zealand Dollar)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->NZD) ? esc_html($currency_data->rates->NZD) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - INR (Indian Rupees)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->INR) ? esc_html($currency_data->rates->INR) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - SGD (Singapore Dollar)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->SGD) ? esc_html($currency_data->rates->SGD) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - BGN (Bulgarian Lev)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->BGN) ? esc_html($currency_data->rates->BGN) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - RON (Romanian)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->RON) ? esc_html($currency_data->rates->RON) : 0; ?>
</span>
</li>
<li>
<span class="wwn-currency wwn-left-float">
<?php esc_html_e(\'GBP (Sterling) - CHF (Swiss Franc)\', \'worldwidenews\'); ?>
</span>
<span class="wwn-currency-rates wwn-right-float">
<?php echo isset($currency_data->rates->CHF) ? esc_html($currency_data->rates->CHF) : 0; ?>
</span>
</li>
</ul>
</div><!--wwn-currency-rates-sec-->
</div><!--currency-update-wrapper-->
</div>
<?php }
$currency_updates = ob_get_clean();
return $currency_updates;
}
add_shortcode(\'wwn_currency_updates\', \'wwn_currency_updates\');
endif;