Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
813 B
2
Indexable
Never
<div class="product-carousel">
    <?php 
    $products = get_field('produkty_tiktok')['produkty'];

    if ($products) {
        $args = array(
            'tax_query' => array(
                array(
                    'taxonomy' => 'product_visibility',
                    'terms' => array('exclude-from-catalog'),
                    'operator' => 'IN',
                ),
            ),
        );

        $product_posts = get_posts($args);

        if ($product_posts) {
            foreach ($product_posts as $post) {
                setup_postdata($GLOBALS['post'] = $post);
                wc_get_template_part('content', 'product');
                wp_reset_postdata();
            }
        } else {
            echo __('No products found');
        }
    }
    ?>
</div>