伙计们。 我在woocommerce的产品页面上添加了一个新标签。很好。
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['photos'] = array(
'title' => __( 'Фото', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_product_tab_photo'
);
$tabs['shipping'] = array(
'title' => __( 'Как купить', 'woocommerce' ),
'priority' => 60,
'callback' => 'woo_product_tab_shipping'
);
return $tabs;
}
// The new tab content
function woo_product_tab_photo() {
foreach(get_post_custom()['photos'] as $photo) {
echo $photo;
//echo '<img class="tab-photos__photo" src="'.$photo.'">';
}
}
但是,有一个错误困扰着我。
mod_fcgid: stderr:
PHP Warning:
Invalid argument supplied for foreach() in
/var/www/admin/data/www/jpegcoma.com/wp-content/themes/divi-child/functions.php on line 62
此外,还有另一个错误,但不确定是否与之相关。
an upstream response is buffered to a temporary file
/var/cache/nginx/proxy_temp/1/68/0000000681 while reading upstream
有人可以请我指出正确的方向来解决它吗?