Support

Account

Home Forums Front-end Issues Seamless Clone field behaving differently get_field vs get_sub_field Reply To: Seamless Clone field behaving differently get_field vs get_sub_field

  • Sorry to resurrect an old thread, but I’ve just been pulling my hair with the same issue on a new project.

    It was proving very difficult to get fields and sub fields to match references, as I needed them to, for various template parts.

    In my example,the client had a broad colour palette,and pretty much every page component (built using flexible content) could use any colour from the palette.

    Rather than manually recreate the colour select field,I thought I’d be a bit more efficient and create a select field in a ‘brand options’ field group,and then clone that field whenever needed. For example:

    – Hero banner
    – – Title
    – – Image
    – – Colour (clone field)

    And

    – Flexible Content
    – – CTA Box
    – – – Title
    – – – Text content
    – – – Colour (clone field)

    In the hero banner, the data is obtained by get_field,the CTA Box by get_sub_field. The colour field for the subfield was a Lot harder to get to.

    I think part of my problem is that I quite like using unique field names, which isn’t necessary for nested content, becausevi findit easier for debugging.