在我的网站

时间:2018-03-01 22:06:50

标签: wordpress woocommerce woocommerce-theming

最近我用wordpress网站进行了更改。我的每个产品页面都有desktop-columns-3 tablet-columns-2 mobile-columns-1

我很无能为力,因为当我搜索这个错误时,它只告诉我尺寸大小没有任何理由我为什么到处都写这个。

enter image description here

解决所有产品页面的问题

enter image description here

3 个答案:

答案 0 :(得分:3)

我也有这个问题,这就是我修复它的方法。

转到wp-content / plugins / woocommerce / includes / wp-template-functions.php

第708行有以下行:

$ loop_start = apply_filters('woocommerce_product_loop_start',ob_get_clean());

该行已在多个地方定义,所以我已将其评论出来并解决了问题。我不知道它是否在其他地方破坏了一些东西,但现在一切似乎都工作正常..如果它确实破坏了我的下一个想法是让它“回声错误”或其他东西。

无论哪种方式,这似乎现在都有效。祝你的网站好运!

答案 1 :(得分:1)

在您的主题下找到一个文件function.php 添加这样的新功能:

    <?php
// add any new or customised functions here

function woocommerce_product_loop_start() {
    ob_start();

    wc_set_loop_prop( 'loop', 0 );

    wc_get_template( 'loop/loop-start.php' );

    $loop_start = apply_filters( 'woocommerce_product_loop_start', 'ob_get_clean()' );

    return $loop_start;
}

它将替换插件中的原始功能。希望这可以解决您的问题

答案 2 :(得分:-1)

在wp-content / plugins / woocommerce / includes / wp-template-functions.php文件中查找woocommerce_product_loop_start函数,并将其替换为以下代码:

if ( ! function_exists( 'woocommerce_product_loop_start' ) ) {
    /**
     * Output the start of a product loop. By default this is a UL
     *
     * @access public
     * @param bool $echo
     * @return string
     */
    function woocommerce_product_loop_start( $echo = true ) {
        ob_start();
        wc_get_template( 'loop/loop-start.php' );
        if ( $echo )
            echo ob_get_clean();
        else
            return ob_get_clean();
    }
}