提问者:小点点

Woocommerce单品断裂


我正在开发一个wordpress主题,由于某种原因,我的woocommerce单一产品坏了。它也显示了它想要的一切,但看起来css和javascript都不起作用。

我已经在我的函数文件中添加了woocommerce支持。
如果我改成了Twenty14主题,那么单产品就正常工作了。
有人能帮我吗?

下面是单产品页面的链接:link


共1个答案

匿名用户

WooCommerce类没有加载到您的网页上。如果您已经添加了WooCommerce主题支持,那么您可能会错过WordPress主体功能。

确保在functions.php中有以下一行

add_theme_support( 'woocommerce' );

还包括WordPress的body函数,标记必须如下所示。

<body <?php body_class() ?>>

如果您已经有任何用于body类,请将该类传递给以下函数:

<body <?php body_class( 'existing-class' ) ?>>

要在主题中启用WooCommerce gallery特性,必须使用add_theme_support()声明支持,如下所示;

add_action( 'after_setup_theme', 'yourtheme_setup' );
function yourtheme_setup() {
    add_theme_support( 'wc-product-gallery-zoom' );
    add_theme_support( 'wc-product-gallery-lightbox' );
    add_theme_support( 'wc-product-gallery-slider' );
}

此处提供更多信息