29 Jul

ACF PRO 5.9 Beta5

By Elliot Condon

ACF PRO 5.9 Beta5 is now available for download πŸŒˆβ˜€οΈ! This includes all the highly anticipated updates shown in our ACF 5.9 – Exciting new features announcement.

To access this release, please login to your store account and select this version from the available downloads shown on the Licenses page. Users who already have a beta version installed will find an automatic update available via the Plugins admin page.

πŸ‘¨β€πŸ’» Please find the release notes below. And for the latest ACF news, follow us on Twitter @wp_acf.

New settings for text alignment

Shortly after announcing the new “align_content” block setting in version 5.9.0-beta4, it was pointed out that a similar setting should also exist for text alignment. This was great feedback, and we are proud to announce two new settings for the acf_register_block_type() function; One to enable text alignment for the entire block, and the other to define an initial alignment value.

Here’s a code example to demonstrate these new settings:

functions.php

<?php 
acf_register_block_type( array(
    'name'				=> 'test_alignment',
    'title'				=> 'Test Alignment',
    'align_text'		=> 'left', // Specifies the default attribute value.
    'supports'			=> array(
        'align_text' => true // Enables the feature.
    ),
    'render_callback'	=> function( $block ){
        echo '<div class="align-text-' . esc_attr( $block['align_text'] ) . '">';
            echo '<p>' . esc_html( $block['align_text'] ) . '</p>';
        echo '</div>';
    }
));

Extended support for content alignment

The newly added “align_content” setting has also received some attention too πŸŽ‰!

Previously, this setting implemented a WordPress 5.5 toolbar button that controlled both the x and y position via a 3Γ—3 matrix grid. With this update, the “align_content” support flag can now be toggled to a simpler mode which controls only the vertical position.

This not only offers more control when developing your block type, but also provides greater compatibility with previous versions of WordPress. Here are some code snippets to demonstrate the various content alignment flags.

functions.php

<?php 

// Register a block type using vertical content alignment.
acf_register_block_type( array(
    'name'				=> 'test_alignment',
    'title'				=> 'Test Alignment',
    'align_content'		=> 'center',
    'supports'			=> array(
        'align_content' => 'vertical'
    ),
    'render_callback'	=> function( $block ){
        echo '<div class="is-position-' . esc_attr( $block['align_content'] ) . '">';
            echo '<p>' . esc_html( $block['align_content'] ) . '</p>';
        echo '</div>';
    }
));

// Register a block type using vertical and horizontal (matrix) content alignment.
acf_register_block_type( array(
    'name'				=> 'test_alignment',
    'title'				=> 'Test Alignment',
    'align_content'		=> 'center center',
    'supports'			=> array(
        'align_content' => 'matrix'
    ),
    'render_callback'	=> function( $block ){
        echo '<div class="is-position-' . esc_attr( $block['align_content'] ) . '">';
            echo '<p>' . esc_html( $block['align_content'] ) . '</p>';
        echo '</div>';
    }
));

New ACF_Location documentation

With our new location architecture complete, the documentation for creating custom location rules via the ACF_Location class is now available! This class implementation is a major improvement over the previous solution which relied on a series of filters to customize location behavior. We’re really happy with the new doc, and would love to hear your feedback too – Custom location rules.

Other enhancements

  • Improved styling of metaboxes shown in the block editor sidebar
  • Fixed bug causing “$” characters to disappear from InnerBlocks content.
  • Fixed PHP warning for deprecated wp_make_content_images_responsive() function in WordPress 5.5.
  • Fixed bug breaking Image field UI when displaying a scaled portrait attachment.
  • Improved AJAX request efficiency when editing a blocks className or anchor attributes.

 

πŸ™Œ Thanks to everyone who helped make this release possible. Think you’ve found a bug? Please post in detail a new support ticket.

About the Author

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.