警告:在wc-template函数中的woocommerce上将零除以零

时间:2017-03-31 09:44:21

标签: wordpress if-statement return-value global empty-list

function wc_get_loop_class() {
    global $woocommerce_loop;

    $woocommerce_loop['loop']    = ! empty( $woocommerce_loop['loop'] ) ? $woocommerce_loop['loop'] + 1   : 1;
    $woocommerce_loop['columns'] = ! empty( $woocommerce_loop['columns'] ) ? $woocommerce_loop['columns'] : apply_filters( 'loop_shop_columns', 4 );
    if ( 0 === ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 === $woocommerce_loop['columns'] ) {
        return 'first';
    } elseif ( 0 === $woocommerce_loop['loop'] % $woocommerce_loop['columns'] ) {
        return 'last';
    } else {
        return '';
    }
}
  

警告:除以零   /home/betawebs/public_html/tech/betawp/attwp/wp-content/plugins/woocommerce/includes/wc-template-functions.php   在第249行=“post-2606”

我的页面上面给出了错误请帮助

1 个答案:

答案 0 :(得分:0)

这将在下一个稳定版本中得到纠正。 看看第260行: https://github.com/woocommerce/woocommerce/blob/master/includes/wc-template-functions.php