可以在functions里添加如下代码:
// Display description tab when empty
add_filter( 'woocommerce_product_tabs', 'display_description_product_tabs' );
function display_description_product_tabs( $tabs ) {
$tabs['description'] = array(
'title' => __( 'Description', 'woocommerce' ),
'priority' => 10,
'callback' => 'woocommerce_product_description_tab',
);
return $tabs;
}
// Add image to description
add_filter( 'the_content', 'add_product_image_woocommerce_description' );
function add_product_image_woocommerce_description( $content ) {
global $product;
// Single product pages (woocommerce)
if ( is_product() ) {
ob_start(); // Start buffering
// HERE your main image
echo $product->get_image( array('700', '600'), array( "class" => "img-responsive" ), '' );
$image_content = "";
// Loop through gallery Image Ids
foreach( $product->get_gallery_image_

本文介绍了如何在WooCommerce产品页面中使用WordPress函数添加详细描述并展示产品图片,包括自定义图片大小和换行显示。通过`display_description_product_tabs`和`add_product_image_woocommerce_description`过滤器,开发者可以增强产品的描述体验。
最低0.47元/天 解锁文章
876

被折叠的 条评论
为什么被折叠?



