douxi6903
2019-01-24 15:24
浏览 37
已采纳

WooCommerce:ACF价值不是通过产品类别

I created custom fields for a WooCommerce category. Location shown below & they work correctly.

Woocommerce category ACF fields

However, when I go to my archive.php file and attempt a the_field('category_banner), it retrieves no data. Here is an example of how I've laid it out.

<?php
$categorybanner      = get_field('category_banner');
$categorydescription = get_field('category_description');
?>

<div class="container-fluid" id="ivy-banner" style="background: url('<?php echo $categorybanner ?>') center / cover"></div>
<h4 class="text-black"><?php echo $categorydescription; ?></h4>

Any reason why this code doesn't work? I can only assume it has got something to do with the location rather than the code itself. How can I circumvent this?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题