Support

Account

Forum Replies Created

  • Hey @all,

    the new ACF 5.9 beta introduces a new innerBlocks feature. Please help the ACF developer team to test this brand new feature and share your experience with Elliot. If you find a bug, do not hesitate to share it here https://github.com/AdvancedCustomFields/acf/issues

  • Here https://wphave.de/acf-performance-optimieren-ohne-abhangigkeit-im-frontend/ I have listed some ACF functions and explained how you can instead use the default WordPress function to increase performance on the frontend without calling ACF functions here.

  • Here you can see how you can allow inner blocks for an ACF wrapper block.

    It’s a workaround, but it works πŸ™‚

    https://gist.github.com/gaambo/633bcd83a9596762218ffa65d0cfe22a

  • I think the best way for ACF is to come up with a solution to extend the core blocks with additional custom fields. That would be great! because we could extend the background options with great things like background animations and more.

    What do you think about this @Elliot ? πŸ˜€

  • Hey,

    is there a new answer from Elliot about the block wrapper? Does Elliot work on it or not?

  • I would like to know the release date of the 5.8 version.

  • Hey @fugamma,

    I’m creating themes with ACF. In my case, the JSON variant is slower as the PHP variant.

    This are my results:

    Loading fields from PHP exported file: Total Queries > 704

    Loading fields from JSON: Total Queries > 851

    Loading fields without JSON or PHP exported file: Total Queries > 1197

    The winner is loading fields from PHP exported file πŸ™‚

  • Here is my solution:

    /*****************************************************************/
    /* LOADING SWITCH FOR ACF FIELD GROUPS FROM PHP OR JSON FILE */
    /*****************************************************************/
    
    add_filter('acf/settings/load_json', function( $paths ) {
        
        $dev_mode = get_field('mode_custom_fields_json', 'option');
        
        // load basic [ MAIN THEME ] field groups from the [ MAIN THEME JSON ] folder
        $paths = array( get_template_directory() . '/inc/acf-json' );
        
        // load custom additional [ CHILD THEME ] field groups from the [ CHILD THEME JSON ] folder
        if( is_child_theme() && $dev_mode ) {
            $paths[] = get_stylesheet_directory() . '/acf-json';
        }
    
        // WITHOUT ACTIVATED DEV MODE --> load all fields from PHP file by the [ MAIN THEME ]
        if( ! $dev_mode ) {
            // load all field groups from PHP exported file for theme users
            include_once( get_template_directory() . '/inc/acf-field-groups.php' );
        }
    
        return $paths;
        
    });
  • Ok, I have solved this issue by myself. The reason why the PHP exported file is not loading inside the if condition, I have loaded the JSON files at the same time with the following code:

    if ( ! function_exists( 'acf_json_load_point' ) ) :
    
            function acf_json_load_point( $paths ) {		
                unset($paths[0]); // remove original path (optional)
                $paths[] = get_stylesheet_directory() . '/inc/acf-json'; // append path
                return $paths;
            }
    
        endif;	
    
        add_filter('acf/settings/load_json', 'acf_json_load_point');

    If I load the “PHP exported file” OR the “JSON files” only, handled by a if condition, everything is fine and it works great πŸ™‚

  • Ok, I have answered the question by myself. The mistake was the missing include ACF plugin main file.

    I could solved all of my issues with including this path:

    include_once( get_stylesheet_directory() . '/inc/plugins/acf/acf.php' );

    So this is the right way:

    STEP 1: Download the ACF PRO plugin ZIP file

    STEP 2: Unzip the ACF PRO plugin ZIP file

    STEP 3: Upload the unzipped ACF PRO package to your theme materials folder like ../your-theme/inc/plugins/acf/[here is the unzipped package located]

    STEP 4: Add the following code to your theme functions.php to load the ACF PRO plugin from the theme folder: include_once( get_stylesheet_directory() . '/inc/plugins/acf/acf.php' );

    STEP 5: Add the β€œ1. customize ACF path” and β€œ2. customize ACF dir” code from my first post to the functions.php and change the path to your theme located ACF PRO folder.

    STEP 6: Add the following code to your theme functions.php to load your custom field groups, if you want to work with all the fields from the PHP exported file
    include_once( get_stylesheet_directory() . ‘/inc/acf-field-groups.php’ );

    This is the best way to add ACF PRO to your theme, without installing the plugin in the main way by the user. So the user will get no notice about a newer version of ACF and the theme developer can control the ACF version with the included ACF theme folder.

    This is great πŸ™‚

  • This reply has been marked as private.
  • This is solving the issue:

    if ( ! function_exists( 'acf_kses_post' ) ) :
    
        function acf_kses_post( $value, $post_id = '', $field = '' ) {        
            
            // exception for option header and footer code
            $header_code = get_field_object('header_code', 'option');
            $footer_code = get_field_object('footer_code', 'option');
            
            if( $field['key'] == $header_code['key'] || $field['key'] == $footer_code['key'] ) {
                return $value;
            }
            
            // escaping all fields  
            if( is_array( $value ) ) {
                return array_map('acf_kses_post', $value);
            }
    
            return wp_kses_post( $value );
    
        }
    
    endif;
    
    add_filter('acf/update_value', 'acf_kses_post', 10, 4);
  • @hube2 now I’ve an other issue with all the fields. This is my code for the specific field exception:

    if ( ! function_exists( 'acf_kses_post' ) ) :
    
        function acf_kses_post( $value, $post_id, $field ) {
        
            // exception for specific fields
            $header_code = get_field_object('header_code', 'option');
            $header_field_key = $header_code['key'];
            $footer_code = get_field_object('footer_code', 'option');
            $footer_field_key = $footer_code['key'];
    
            
            if( $field['key'] == $header_field_key || $footer_field_key ) {
                return $value;
            }
            
            // escaping all fields  
            if( is_array($value) ) {
                return array_map('acf_kses_post', $value);
            }
    
            return wp_kses_post( $value );
    
        }
    
    endif;
    
    add_filter('acf/update_value', 'acf_kses_post', 10, 4);

    The issue is now I can add <script> tags to all other fields too. Is there anything missing in the code?

  • @hube2 you’re right πŸ™‚ Thank you it works !!!

    With the field name:

    if( $field['name'] == 'footer_code' ) {
            return $value;
        }

    Or with the field key:

    $footer_code = get_field_object('footer_code', 'option');  
        $field_key = $footer_code['key'];  
          
        if( $field['key'] == $field_key ) {
            return $value;
        }
  • @hube2 thank you for helping me. I’ve tested this but it dosen’t work.

    My field is: get_field('footer_code', 'option');

    And the exception:

    if( $field['key'] == 'footer_code' ) {
            return $value;
        }
  • I’ve created a support ticket:

    I have a annoying issue / bug with missing fields in the exported JSON file and generated PHP file. So it’s not possible for me to …

    1. … export my existing field group and import it again to a other wordpress installation.

    2. … use “include_once( get_template_directory() . ‘/inc/acf-field-groups.php’ );” to load the field groups from the generated PHP file instead of the JSON file for user which are working with a child theme.

  • The issue is solved with a fallback which is included in ACF 5.6.7.

  • @elliot Thanks Elliot for this fix. The fallback solve my issue with the non-active tabs and set the first tab to active, if there is this active class missing for other tabs.

    I hope you can find the main reason and fix this issue completely.

  • @okadots I’ve a reply from the ACF developer:

    We have just isolated some broken logic in the latest version that was affecting tabs and flexible content validation. Could you please redownload the ACF plugin files from your store account and check if the issue will still manifest?

    Can you please test it? In my case this is not solving the issue. My tab areas are still hidden.

  • That is very strange! That’s a very annoying issue. I hope to quickly fix this bug with the next version 5.6.7 of ACF. I think this issue comes with the new saving of the last active tab functionality of the latest update.

  • +1

    I’ve the same issue with ACF 5.6.6.! Some of my tab sections are hidden. I have figured out, in my case the error occurs only with old posts or pages. If I add a new post or page, the tab sections are displayed correctly.

    I’ve created a support ticket a wait for replying of the ACF developer.

  • I have opened a support ticket.

  • @hube2 hey john, thanks for the answer. I thought the field groups would not be updated when I import new field groups. In the past, however, I imported field groups and no JSON files were automatically created. But I’ve figured out that JSON files are now automatically created after importing new field groups. Maybe that was fixed with one of the past updates? Now it works fine πŸ™‚

Viewing 25 posts - 1 through 25 (of 62 total)