【发布时间】:2015-07-25 07:08:23
【问题描述】:
我正在尝试在普通的 html 表格中显示 WooCommerce 产品列表。这些产品确实是简单的产品;每个都包含一个产品名称、两个自定义字段(质量和尺寸)和一个“添加到报价”按钮。这就是将在前端显示的所有内容。
在 loop-start.php 中,我添加了开头的 <table> 标记。在 loop-end.php 中,我添加了结束 </table> 标记。但是,当加载前端页面并查看源代码时,每个产品都有自己的<table> 和</table> 标签。我只想要一张桌子...
循环启动.php:
<table> <?php echo (function_exists('sometheme_woo_shop_columns_class') ? sometheme_woo_shop_columns_class() : ''); ?>">
循环结束.php:
</table>
内容产品.php:
<?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
<?php
/**
* woocommerce_before_shop_loop_item_title hook
*
* @hooked woocommerce_show_product_loop_sale_flash - 10
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action( 'woocommerce_before_shop_loop_item_title' );
?>
<tr>
<td> <h5><?php the_title(); ?></h5></td>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_rating - 5
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
<td> <?php echo get_post_meta( get_the_ID(), '_mass_field', true ); ?></td>
<td> <?php echo get_post_meta( $post->ID, '_dimensions_field', true ); ?></td>
<td>
<?php
/**
* woocommerce_after_shop_loop_item hook
*
* @hooked woocommerce_template_loop_add_to_cart - 10
*/
do_action( 'woocommerce_after_shop_loop_item' );
?>
</td>
</tr>
前端产品页面来源:
<div class="relative-container">...</div>
<div cass="boxed layout boxed colors</div>
<table>...</table>
<div class="relative-container">...</div>
<div cass="boxed layout boxed colors</div>
<table>...</table>
<div class="relative-container">...</div>
<div cass="boxed layout boxed colors</div>
<table>...</table>
<div class="relative-container">...</div>
<div cass="boxed layout boxed colors</div>
<table>...</table>
etc.
【问题讨论】:
标签: html woocommerce html-table