0
我試圖在我的商店歸檔頁面上顯示自定義產品滑塊。滑塊工作正常,但在它之後woocommerce_content();也只是告訴我滑塊的產品,而不是全部。有沒有人知道爲什麼?我無法找到woocommerce的特殊數據重置。在WooCommerce循環之前重置WordPress PostData
<?php
get_header();
?>
<div id="product-slider">
<?php
if (is_shop()):
$posts = get_field('produkte_hervorheben_slider',4);
if($posts): ?>
<?php foreach($posts as $post): ?>
<?php setup_postdata($post); ?>
<div>
<a href="<?php the_permalink(); ?>">
<div class="bg-slide" style="background-image:url('<?php echo get_the_post_thumbnail_url(); ?>');">
</div>
</a>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif;endif; ?>
</div>
<main>
<div class="container woocommerce">
<?php
woocommerce_content();
?>
</div>
</main>
<?php
get_footer();
?>
預先感謝您!
馬文