A simple check should do:
$location = get_field('location'); if($location) : echo '<p>acf stuff' . $location . '</p>'; endif;
The shortcode only returns simple text-based values, so if the
agent_picture returns an array of image info, then the shortcode will not be ideal for your use case. However, you can probably use it to display an agent’s name, email, and phone, assuming that all those values are stored in text, email, and tel type fields.
Anyway, I think you are getting the shortcode confused with code that would happen in a code loop that goes through the homes. The logic would look something like this for your use case:
foreach home CPT as Home Display Home info Get all Agents assigned to Home foreach Agents as Agent Display Agent info (this is where you can use the shortcode) endforeach loop endforeach loop
Hi John! Thanks for your response. For bug 2, there are actually 2 separate clone fields that clone the same field group. In my example, Header (component field group) and Footer (component field group) are 2 separate clone fields. I enabled prefix for both of them and that was where I saw the bug. Enabling prefix on the labels and field names gave me this setup:
The base field group for the component has these fields without the prefixes:
I use clone fields heavily to make managing component blocks and their fields easier. There are some things about the Group setting that I dislike similar to alpipego. Since the seamless fields have conditional displays within that field group, is it possible to have a “nested” set of display fields for seamless fields too that are honored at the parent-level? For example:
Background Settings Field Group
– Background Type (radio)
— Option 1: None
— Option 2: Color
— Option 3: Image
– Background Color (color picker; displays when “Option 2: Color” is selected)
– Background Image (image; displays when “Option 3: Image” is selected)
Then in a flexible field, there is a group of flexible fields that reuses the background settings field group like so.
– Content (WYSIWYG)
– Media Type (radio)
— Option 1: Image
— Option 2: Form
– Image (image; displays when “Option 1: Image” is selected)
– Form (post object; displays when “Option 2: Form” is selected)
– Form Background (clone; displays when “Option 2: Form” is selected) <– Honor this conditional display in parent flexible fields, and then honor conditional display in fields of field group
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!