我试图在woocommerce中显示大小的属性。
我正在使用
<?php
$terms = get_terms("pa_size");
foreach ( $terms as $term ) {
echo "<p>. $term->name .</p>";
?>
然而,由于某种原因它似乎打破了页面。
完整代码
<div class="titleSP">
<h2><?php the_title(); ?></h2>
<h2><?php the_title(); ?></h2>
</div>
<div class="priceSP">
<?php echo $product->get_price_html(); ?>
<link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
</div>
<?php
//code to pull in the attrs
$terms = get_terms("pa_size");
foreach ( $terms as $term ) {
echo "<p>. $term->name .</p>";
?>
<?php if($post->post_excerpt) { ?>
<div class="descriptionSP short">
<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); ?>
</div>
<?php } ?>