Please bear with me. New to programming.
I’m trying to create a restaurant menu using ACF and the repeater plugin.
The screenshot below shows what I’m trying to achieve. This is the backend which already adds the data to the database.
This is my basic loop to grab the fields needed.
<?php while( have_rows('menus') ): the_row(); ?>
<?php
$item_name = get_sub_field('item_name');
$item_price = get_sub_field('item_price');
$item_description = get_sub_field('item_description');
$special = get_sub_field('special');
?>
<h1 class="<?php echo $special"?>>
<?php echo $item_name ?>...<?php echo $item_price ?>
</h1>
<h2><?php echo $item_description ?></h2>
<?php endwhile; // end of the loop. ?>
I have three templates each showing the same menu but in certain pages ‘special’ items will be shown where a class is set to be styled in CSS.
e.g
King’s Cross Page lists Dish 1 and Dish 2(special)
but
Covent Garden Page lists Dish 1 and skips Dish 2 because it’s selected to be a special for King’s Cross.
how can I skip fields not assigned to a certain template?
Thank you.