ACF-aware sorting
What is ACF
Advanced Custom Fields (ACF) is a WordPress plugin that lets you create and manage additional data fields for posts, pages, and custom post types. Instead of relying only on WordPress’s built-in fields like title or date, ACF allows you to define your own such as event dates, product ratings, or team member roles.
Divi Loop Extender integrates directly with ACF. When ACF is active on your site, the Loop Extender automatically detects available ACF fields and exposes them in the Loop accordion under Sorting and Query Settings. This makes it possible to build data-driven layouts in Divi 5 that display and order content dynamically, without custom PHP or manual database queries.
Why sort by ACF data
Sorting by ACF fields allows you to prioritize or schedule content based on business logic rather than publish order. For example:
- Display upcoming events using an ACF event_date field.
- Order testimonials using an ACF priority number.
Because Divi Loop Extender reads ACF field metadata directly, you can configure these sorts visually in the Divi 5 interface.
Supported field types
- Number fields for scores, prices, or rankings.
- Date and date-time fields for events and schedules.
- Text fields for alphabetical sorting.
When sorting by date or number fields, ensure the ACF field format matches the stored value type. Inconsistent data formats (for example, using text instead of numeric values) can cause unpredictable results.
Planning tips
- Keep ACF field names consistent across all relevant post types.
- Standardize value formatting (for example, YYYY-MM-DD for dates).
- Test loops on a staging site with realistic ACF data before deploying.