I have a wordpress site using advanced custom fields pro with the repeater fields enabled.
Can anyone think of a way to integrate
- A repeater field for uploading images with
- A repeater field select dropdown
Such that on the back-end the client can either
- Select an image to go with a menu item from a dropdown of pre-existing images; or
- Upload an image to go with the menu item that will then be available in the dropdown for future uses
The page currently in development is viewable at http://elmeson.dukecitydigital.com/?page_id=1732
Where you can see how the flags go with the menu items.
The code i’m using for the dropdown select is
<?php if ( have_rows('menu_items') ):
while ( have_rows('menu_items') ): the_row(); ?>
<div><?php the_sub_field("menu_item_name");?></div>
<div><?php the_sub_field("menu_item_price");?></div>
<div><?php the_sub_field("menu_item_description");?></div>
<?php
$flagname = get_sub_field('menu_item_flag');
if ($flagname === "andalucia") {
$image_url = "img/andalucia.png";
} elseif ($flagname === "asturias") {
$image_url = "img/asturias.png";
} elseif ($flagname === "aragon") {
$image_url = "img/aragon.png";
<div><?php the_sub_field($image_url);?></div>
Thanks a lot for your consideration