Home Forums ACF PRO Shortcode for fields attached to taxonomies Reply To: Shortcode for fields attached to taxonomies

  • Hi Steven,

    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