I created custom fields for a WooCommerce category. Location shown below & they work correctly.
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?