
Делаю виджет который вывод избраные товары, вот код
Проблема в том что не выводи цену товара, такое осущение что ее нет, что я не так делаю (
PHP:
<?php
$args = array(
'post_type' => 'product',
'meta_query' => array(
'key' => '_featured',
'value' => 'yes',
),
'posts_per_page' => $pcount,
);
$featured_query = new WP_Query($args);
?>
<?php if ( $featured_query->have_posts() ) : ?>
<section class="card-product">
<div class="container">
<div class="row">
<h1 class="card-product-h1"><?php echo $title; ?></h1>
<div class="flexslider carousel">
<ul class="slides ">
<?php while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?>
<?php $i == 0; ?>
<?php $bigen_li = ' <li>'; ?>
<?php $end_li = '</li>'; ?>
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'shop_catalog', true);
?>
<?php if( $i % 2 == 0): ?>
<?php echo $bigen_li; ?>
<?php endif; ?>
<?php
global $product;
$class = implode( ' ', array_filter( array(
'button',
'product_type_' . $product->product_type,
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
$product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : ''
) ) );
?>
<div class="card">
<a href="<?php the_permalink(); ?>">
<ul>
<li class="card-hit"><span>Хит</span></li>
<li class="card-discount"><span>Скидка</span></li>
<li class="card-new"><span>NEW</span></li>
</ul>
<div class="card-body">
<div class="img-cart" style="background-image: url(<?php echo $thumb_url[0]; ?>);background-repeat: no-repeat;background-size: contain; background-position: center;padding: 20px 10px;height: 100%;width: 100%;">
</div>
</div>
<div class="card-footer">
<span class="short-description-card"><?php the_title(); ?></span>
<table>
<tr class="articul-card">
<td>опт</td>
<td>Артикул: <?php echo $product->sku; ?></td>
</tr>
<tr class="price-buy">
<?php if($price_html = $product->get_price_html()) :?>
<td><span class="price-old">2 000 руб</span><span class="price-card">1370 руб</span></td>
<td><a href="#" class="buy-btn-cart"><i class="fa fa-shopping-cart" aria-hidden="true"></i>Купить</a></td>
<?php endif;?>
</tr>
</table>
</div>
</a>
</div>
<?php if( $i % 2 != 0): ?>
<?php echo $end_li; ?>
<?php endif; ?>
<?php $i++; ?>
<?php endwhile; ?>
</ul>
</div>
</div>
</div>
</section>
<?php else: ?>
<!-- no posts found -->
<?php endif; ?>
<?php wp_reset_postdata(); ?>