Unfortunately I didn’t work out how to add the filters from the support above. I got around the issue via CSS in the end.
You can find the code that I have added to content section here.
Still struggling to remove comma from displayed results. Not sure if I can add something to this code or to CSS for the div to remove a comma from results…
The custom post type I created can be found here.
It works perfectly, as a page, but unfortunately I cannot point to it directly from the buddypress groups tab as described above…
Best regards
John
Hi Dennintion,
Thanks for the follow-up.
I am using buddypress groups tabs creator pro.
https://buddydev.com/plugins/buddypress-group-tabs-creator-pro/
It is an excellent plugin, and very simple to use. Unfortunately it cannot point to unqique urls and keep the group header, thus I need to input via dynamic content section and use shortcodes.
Hope that makes sense.
Best regards
John
Hi John,
I have added this to the functions.php. As you can tell I am a beginner with this…
//Advanced Custom Fields custom functions for displaying arrays.
function my_acf_format_value( $value, $post_id, $field ) {
// Render shortcodes in all textarea values.
return do_shortcode( $value );
}
add_filter(‘acf/format_value’, ‘my_acf_format_value’, 21, 3);
implode(‘, ‘, $array);
$value = implode(‘<hr>’, $value);
// Apply to select fields.
add_filter(‘acf/format_value/type=select’, ‘my_acf_format_value’, 22, 3);
So if I add the example code from here, https://www.advancedcustomfields.com/resources/acf-format_value/
to the functions.php and then change the values as you have described above it should work?
Thank you for the quick response John, I really appreciate your help.
I understand that shortcodes are set-up for simple fields, but it is working in the_content section of a page I have to use.
The output can be seen here.https://legally-linked.com/groups/clifford-chance/law-firm-technology/
All the boxes are showing the array via shortcode.
I have had a look at the format value link you sent, not sure what to add to functions.php
Something here for shortcodes for select or array fields
// Render shortcodes in all select values.
return do_shortcode( $value );
}
or something with this
acf/format_value/type={$type}
It’s not clear how to remove the commas.
Best regards
John
Hi John,
Thank you for your help, I have only just seen the response.
I have got around the issue by using shortcodes function, after setting-up a custom post type.
Although it states in documentation that you can only use the shortcode function for text fields, it is working as required with a select field. We have put code in to the value choices.
The only issue now is that the array is showing a comma after each value and we can’t seem to get rid of it. Do we need to update the shortcode function.
I can send you the custom post type code and use of shortcode in a content section.
Best regards
John
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.