Support

Account

Home Forums Front-end Issues Render Field Group Titles on Front End

Solved

Render Field Group Titles on Front End

  • Greetings all!

    Currently have a custom post type (ACF Form) that displays 4 separate Field Groups.

    I would like to render the Field Group Title on the Front Like they are on the backend, don’t need the sort order and such as available on the back end.

    Started digging into ACF form to see how the fields are rendered and believe I am missing the obvious answer here. Can someone point me in the right direction how to add the title to the output?

    Thanks!

  • This reply has been marked as private.
  • Here’s what I did as a work around. I have to believe there is a more elegant way to do this, fewer db calls and such. I’ll have to research this in the future.

    Layout of the Entry Post Type:

    • ACF FORM (single-entry.php)
      1. Category One Field Group (Entry Post Type Selected in Admin)
      2. Category Two Field Group (Entry Post Type Selected in Admin)
      3. Category Three Field Group (Entry Post Type Selected in Admin)

    I took the field key from the first field in the Field Group and ran a prepare_field for each.

    add_filter('acf/prepare_field/key=field_58f8d36119412', 'format_entry_header');	// Category One Header
    

    When found, the prepare_field outputs a <div> with my Header Information. This in displayed before the Field and with a little CSS, looks good.

    echo '<h3 class="entry-form-title">Maintenance Factors</h3>';
    

    The drawback is that you can not have the fields in a tab or you will get the <div> at the bottom of the first tab AND where intended. Haven’t dug into this much more as I need a solution quickly.

    Not sure I should mark this as solved?

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

The topic ‘Render Field Group Titles on Front End’ is closed to new replies.