وردپرس

Do Even More With Less Code in ACF 6.2


WP Engine is continuing to invest in Advanced Custom Fields (ACF) and with the release of ACF 6.2, we’ve got some real goodness to share today!

Bidirectional Relationship Support

If you work with ACF long enough, you eventually encounter a use case where you want to wire up something known as a bidirectional relationship between two fields. This means that when a content editor changes a relationship field against one piece of content, it automatically updates the relationship in the other direction for the linked piece of content.

If that sounds a bit confusing, let me give you an example!

Say you have a website that showcases and ranks the top 100 films from the greatest decade of cinema, aka the 90s! (Bonus content here from our DE{CODE} session where we walk through this project for real!). 

On this website, you want to create relationships between the different films and their directors. For “reasons,” you have both films and directors set up as separate custom post types.

What you want to do now is that whenever a new film is added, and the director is selected, (from a relationship field) then over on the relevant director, the film is automatically added as well. This two-way connection saves significant editorial time, keeping the relationship between the two content pieces (film and director) automatically in sync.

While ACF has long been used for this sort of thing,  it has, until now, required either custom code or the use of a third-party plugin. ACF users have for many years been asking for native support, and with version 6.2 this week, we finally have it!

Check out the video below for how easy it is to set up.

If you want a deeper look, this recent ACF Chat Friday’s session with Iain Poulson will give you a solid walkthrough of how it works!

BTW, if you agree with me that Steven Spielberg’s Hook is the best film of the 90s, here’s a coupon for four months of WP Engine hosting for free

Options Page Registration UI

Carrying on with the theme of natively enabling popular functionality, version 6.2 of ACF PRO lets you register, configure, and manage your custom Options Pages within the UI. Again, this is something users previously relied on custom code for.

Options Pages are an unknown feature for some ACF users, so let me break them down for you. Again, with our awesome 90s film website, we want to include a simple top-of-the-page call-to-action banner on the front end for users to vote for their favorite film.

Now we want to edit the text and button of this CTA and toggle it on and off based on the allowed voting window. A handful of text and boolean fields make this fairly simple, but this CTA bar is site-wide, not tied to a specific post or page. It’s these kinds of site-wide fields that belong in options pages.

Everything from CTA banners to site colors, fonts, and other site settings can be delivered to the WordPress user through one or more custom Options Pages. I’ve talked to many agencies over the years that provide their clients with rich global configuration options via Options Pages.

Needless to say, what once had to be done through code, can now be done in the app UI itself. Check out this short demo below.

The Options Pages feature is only available in ACF PRO.

And More!

The 6.2 release is packed with other features, improvements, and bug fixes. Check out the release post from the team and the full changelog to learn more.

Grow your WordPress and ACF Skills

ACF is central to the way so many build with WordPress, and our developer advocate team is investing more and more into events and content to enable you to succeed. If you want to grow as a WordPress professional, check out our Builders community. Plenty of ACF goodness is waiting there for you!

این خبر را در ایران وب سازان مرجع وب و فناوری دنبال کنید

مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد

منبع: انجمن وردپرس

دکمه بازگشت به بالا