Comment puis-je afficher les produits les plus vendus dans le thème

Je voudrais envisager produit best-seller dans cette boucle :

<?php
    $args4 = array( 'post_type' => 'product', 'posts_per_page' => 1, 'product_cat' => 'cat', 'order' => 'DEC' );
    $loop4 = new WP_Query( $args4 );
    while ( $loop4->have_posts() ) : $loop4->the_post();?>
    <div class="view-back">
        <span><?php echo $product->get_categories( ) ?></span>
        <span><?php echo $product->get_price_html(); ?></span>
        <a class="pb" href="<?php echo get_permalink( $loop4->post->ID ) ?>">more<i class="fa fa-arrow-circle-o-right fa-2x" aria-hidden="true"></i></a>
        <span class="pt"><?php the_title(); ?></span>
    </div>
    <?php $image4 = wp_get_attachment_image_src( get_post_thumbnail_id($loop4->post->ID), 'single-post-thumbnail' );?>
    <img src="<?php  echo $image4[0]; ?>" data-id="<?php echo $loop4->post->ID; ?>">
    <?php endwhile; ?>
    <?php wp_reset_postdata(); ?>
  • Peut-être que ce lien peut vous aider: wpza.net/... comme un guide clair. À l'aide de total_sales comme un meta_key, lors de la commande par meta_value_num.
InformationsquelleAutor Mr Yar | 2017-03-13