Forum Replies Created

  • A simple check should do:

    $location = get_field('location');
    if($location) :
        echo '<p>acf stuff' . $location . '</p>';
  • Is there another field on the same page/post with the same field name? I’ve had this happen to me before, and the second field instance will override the first.

  • Have you tried the latest ACF version? It supports pagination on repeater fields to help with load time.

  • 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
  • Thank you for your response! I posted a reply to you for bug #2, but I’m not seeing it anymore. I will submit via the link you provided.

  • 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:

    1. Content (block field group)
      1. Header (component field group)
        Prefix: Header

        1. Header Content Type (radio field)
          Field Name: header_content_type
        2. Header Content (wysiwyg field, shows if Header Content Type = “content”)
          Field Name: header_content
        3. Header Code (textarea field, shows if Header Content Type = “code”)
          Field Name: header_code
      2. Footer (component field group)
        Prefix: Footer

        1. Footer Content Type (radio field)
          Field Name: footer_content_type
        2. Footer Content (wysiwyg field, shows if Footer Content Type = “content”)
          Field Name: footer_content
        3. Footer Code (textarea field, shows if Footer Content Type = “code”)
          Field Name: footer_code

    The base field group for the component has these fields without the prefixes:

    1. Content (component field group)
      1. Content Type (radio field)
        Field Name: content_type
      2. Content (wysiwyg field, shows if Content Type = “content”)
        Field Name: content
      3. Code (textarea field, shows if Content Type = “code”)
        Field Name: code
  • I see what you mean John. Thanks for the insight.

  • 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

Viewing 8 posts - 1 through 8 (of 8 total)