I’m using this theme on my WordPress site:

https://woocommerce.com/products/artificer/

It is the latest version of WordPress, Artificer and WooCommerce. It used to work fine, but broke at some point. If I look in Firebug, I can see the div it’s supposed to go in, but there is nothing there:

<ul class="featured-products">

        <!-- The first 3 -->
        <!-- the large 1 --><!-- the last 3 -->     </ul>

any suggestions on what I can test/debug? The code in index.php for this part, is:

<?php if ( is_woocommerce_activated() ) { ?>

<ul class="featured-products">

<!-- The first 3 -->
<?php
$args = array( 'post_type' => 'product', 'posts_per_page' => 3, 'meta_query' => array( array('key' => '_visibility','value' => array('catalog', 'visible'),'compare' => 'IN'),array('key' => '_featured','value' => 'yes')) );
$loop = new WP_Query( $args );

while ( $loop->have_posts() ) : $loop->the_post(); $_product;

if ( function_exists( 'get_product' ) ) {
    $_product = get_product( $loop->post->ID );
} else {
    $_product = new WC_Product( $loop->post->ID );
}

?><li class="featured">

            <?php //woocommerce_show_product_sale_flash( $post, $_product ); ?>
            <a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />'; ?>


            <h3><?php the_title(); ?> <span class="price"><?php echo $_product->get_price_html(); ?></span></h3>

            </a>

    </li><?php endwhile; ?><!-- the large 1 --><?php
$args = array( 'post_type' => 'product', 'posts_per_page' => 1, 'offset' => 3, 'meta_query' => array( array('key' => '_visibility','value' => array('catalog', 'visible'),'compare' => 'IN'),array('key' => '_featured','value' => 'yes')) );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
if ( function_exists( 'get_product' ) ) {
    $_product = get_product( $loop->post->ID );
} else {
    $_product = new WC_Product( $loop->post->ID );
}
?><li class="featured">

            <?php //woocommerce_show_product_sale_flash( $post, $_product ); ?>
            <a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_single'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />'; ?>


            <h3><?php the_title(); ?> <span class="price"><?php echo $_product->get_price_html(); ?></span></h3>

            </a>

        </li><?php endwhile; ?><!-- the last 3 --><?php
$args = array( 'post_type' => 'product', 'posts_per_page' => 3, 'offset' => 4, 'meta_query' => array( array('key' => '_visibility','value' => array('catalog', 'visible'),'compare' => 'IN'),array('key' => '_featured','value' => 'yes')) );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); $_product;
if ( function_exists( 'get_product' ) ) {
    $_product = get_product( $loop->post->ID );
} else {
    $_product = new WC_Product( $loop->post->ID );
}
?><li class="featured">

            <?php //woocommerce_show_product_sale_flash( $post, $_product ); ?>
            <a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />'; ?>


            <h3><?php the_title(); ?> <span class="price"><?php echo $_product->get_price_html(); ?></span></h3>

            </a>

        </li><?php endwhile; ?>
</ul>

<?php } ?>

Thanks!

Read more here: Artificer "featured" images stopped showing on homepage


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: