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.
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:
<?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>';
}
));
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.
<?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>';
}
));
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.
wp_make_content_images_responsive()
function in WordPress 5.5.
🙌 Thanks to everyone who helped make this release possible. Think you’ve found a bug? Please post in detail a new support ticket.
Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.