Skip Navigation

[Resolved] show acf shortcode in views

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 1 voice.

Last updated by herbie4 1 week, 5 days ago.

Assisted by: Minesh.

Author
Posts
#2833185

I want to show a acf text field as shortcode in a view.
I added [acf] to the Third-party shortcode arguments.
But the shortcode [acf field='lid_info_plaats' post_id='[wpv-post-id]'] does not show content.
Yes, I checked that the field exists and has a value.

Any suggestions?

Kind regards, hrbrt

#2833277

UPDATE
I also added this function to activate acf shortcodes.

add_action( 'acf/init', 'set_acf_settings' );
function set_acf_settings() {
acf_update_setting( 'enable_shortcode', true );
}

#2833324

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please tell me what ACF custom field you want to display and exactly where.

Please share admin access details and problem URL and whthin what view you want to display ACF field.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2833342

This is in local development environment so no login possible.

what: acf text field as shortcode: [acf field='lid_info_plaats' post_id='[wpv-post-id]']
where: in a Toolset view (content template, loop item)
how: I added [acf] to the Toolset Third-party shortcode arguments.

But the shortcode does not show content.

Kind regards, hrbrt

#2833346

UPDATED INFO
I switched on extended debug from toolset and tried acf code with a fixed id instead of [wpv-post-id]' -> but this also does not work
Looks like the acf shortcode is filtered out.

debug output raw

<div class="vlk-lid-detail"><div style="display:none" class="wpv-addon-maps-marker js-wpv-addon-maps-marker js-wpv-addon-maps-marker-marker-lid-36520 js-wpv-addon-maps-markerfor-map-leden-1" data-marker="marker-lid-36520" data-markertitle="De Kluskabouter" data-markerfor="map-leden-1" data-markerlat="52.221154" data-markerlon="4.526267" data-markericon="" data-markericonhover="" data-streetview="no" data-fromview="">
<div><h4>De Kluskabouter</h4>
<p></p>
<p>hidden link">Bekijk bedrijfsprofiel</p></div>
</div>
<h4>De Kluskabouter</h4>
<p class="vlk-werksoort"></p>
<p><i class="fusion-li-icon fa-map-marked fas" style="color:#040044;" aria-hidden="true"> </span><br />
<span class="vlk-pc-plaats"> <br />

<i class="fusion-li-icon fa-envelope fas" style="color:#040044;" aria-hidden="true"> </br >
<i class="fusion-li-icon fa-mobile-alt fas" style="color:#040044;" aria-hidden="true"> </p>
<p>hidden link">Bekijk bedrijfsdetails</p></div>

source code loop item

[wpv-map-marker map_id='map-leden-1' marker_id='marker-lid-[wpv-post-id]' marker_title='[wpv-post-title output="sanitize"]' marker_field='wpcf-member_address']
<div><h4>[wpv-post-title]</h4>
<p>[wpv-post-taxonomy type="werksoort" format="name" separator=" | "]</p>
<p>[wpv-post-read-more label="Bekijk bedrijfsprofiel"]</p></div>
[/wpv-map-marker]
<h4>[wpv-post-title output="sanitize"]</h4>
<p class="vlk-werksoort">[wpv-post-taxonomy type="werksoort" format="name" separator=" | "]</p>
<p><i class="fusion-li-icon fa-map-marked fas" style="color:#040044;" aria-hidden="true">  [acf field='lid_info_straat' post_id='[wpv-post-id]']</span><br />
<span class="vlk-pc-plaats">[acf field='lid_info_postcode' post_id='36520'] [acf field='lid_info_plaats' post_id='36520']<br />
[wpv-conditional if="('[wpv-search-term param="toolset_maps_distance_center"]' ne '')"]
<i class="fusion-li-icon fa-street-view fas" style="color:#040044;" aria-hidden="true">  [toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-member_address'] km<br />
[/wpv-conditional]
<i class="fusion-li-icon fa-envelope fas" style="color:#040044;" aria-hidden="true">  [acf field='lid_info_email' post_id='[wpv-post-id]']</br >
<i class="fusion-li-icon fa-mobile-alt fas" style="color:#040044;" aria-hidden="true">  [acf field='lid_info_mobiel' post_id='[wpv-post-id]']</p>
<p>[wpv-post-read-more label="Bekijk bedrijfsdetails"]</p>

#2833352

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

what if you try to use:

[acf field="lid_info_postcode"]

Does that display the relatied information?

#2833353

No, that does not.

UPDATE putting the shortcode in a regular page gives me an error:
The requested ACF field is not allowed to be output in bindings or the ACF Shortcode.
So I will contact acf support about this first. After that I will let you know if this is resolved.

#2833355

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok fine - please update me how it goes.

#2833356

Okay, I have got it working.

1. acf field needs t be set to allowed in public UI in field settings! So it will show on front end.
2. activate shortcodes with
add_action( 'acf/init', 'set_acf_settings' );
function set_acf_settings() {
acf_update_setting( 'enable_shortcode', true );
}
That is all and it works now.