Home Forums General Issues using ACF without access to custom-post.php


using ACF without access to custom-post.php

  • Hi there,

    I have been using ACF with buddypress and an plugin to add custom pages to profiles / groups.

    I have successfully added fields to use with these posts. However, there are no associated custom-post-type.php file to add the suggested php code.

    I think the custom post types are created dynamically or something…

    Is there a way to get and display fields without access to custom-post-type.php file?

    Thanks for your help,

    Best regards


    PS I tried numerous times to send this a support ticket, but it fails with no explanation as why

  • There was an issue with emails sent from the ACF websites that was causing the errors contacting support…..

    If there are no templates that can be edited then you need to rely on the other plugin providing hooks that allow adding or filtering content that is shown. You need to look into the other plugin and find out if they provide a way to make the changes you want to make.

  • 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


  • ACF shortcodes only work with simple fields. Select fields are not simple fields and store arrays. You can use this filter to format field values if they need to be other than what ACF returns.

  • 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.

    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


    It’s not clear how to remove the commas.

    Best regards


  • You need to set the priority of the format value filter to >10 so that it runs after ACF formats the value because your changes may be ignored it you try to do it before acf runs and priority 10.

    ACF formats a select field by using

    implode(', ', $array);

    What you need to do is to format the array the way you want it to appear. For example if you want the value to have breaks after each value you could do

    $value = implode('<br />', $value);

    or if you wanted it to be a bulleted list you could do something like

    $value = '<ul><li>'.implode('</li><li>', $value).'</li></ul>
  • So if I add the example code from here,

    to the functions.php and then change the values as you have described above it should work?

  • 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);

  • Hi JJWWP,

    What plugin to add custom pages to profiles / groups in buddypress do you use?


  • Hi Dennintion,

    Thanks for the follow-up.

    I am using buddypress groups 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


  • 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


  • 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…

  • 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.

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

You must be logged in to reply to this topic.