Display ACF field from an ACF options page? [Answer provided]

Is this possible natively, or will I have to use the php code action or something?

The reason I’m trying to do this is to display a form (created with a plugin) using a shortcode (I’ve added some code to functions.php to render the shortcode for this specific field).

I’d really like to do it in a way that will enable me to easily pull in the content from the site for styling, rather than copy and paste back and forth (love that feature).

I’m very new to the app, so forgive me if there’s an obvious method to this :slight_smile:

1 Like

It is very much possible from within PG:

Select your element in the Pinegrow tree, then go to Wordpress Actions and search for ACF. Select “Display ACF field” and enter the name of the field.

That should do it.

E.g. my current project is full of it https://haasrode.be/company/jj-drinks/

Thanks for the reply. I can’t seem to get this working with fields from an acf options page…

The output code needs the option parameter, like so:
echo get_field( 'field_name', 'option' );
But instead it’s like:
echo get_field( 'field_name' );

And there’s no option for me to add the option :slight_smile:

Did you ever find a solution to this? I am trying to do similar.

I just used the php action :wink:

Ah yes makes sense. In the end I realised what I was trying to achieve was better implemented using a Customizer field anyway.

@matjaz would it be possible that you split the options by comma and then generate the get_field() code? Or just add a checkbox for “Use options” to the Attribute Panel?

I mean, if we have to use a PHP action for this anyway then the ACF field Smart action can be abandoned completely and removed from Pinegrow.

The Post field action with ACF is very useful for displaying normal post fields, would be a shame to lose it :wink:

I added “Object id” option to the ACF Field actions, that among other values, also lets you select “options”. Will be out in the next release.

3 Likes

Perfect. Can’t wait . :wink:

1 Like