* (string) Determines where field labels are places in relation to fields. * (string) Determines the metabox style. Choices of 'acf_after_title', 'normal' or 'side' */ * (string) Determines the position on the edit screen. * (int) Field groups are shown in order from lowest to highest. * (array) An array containing 'rule groups' where each 'rule group' is an array containing 'rules'.Įach group is considered an 'or', and each rule is considered an 'and'. * (string) Unique identifier for field group.
#GENERATE PHP PAGE PHP MAKER HOW TO#
This example demonstrates how to add a field group. NameĪcf_add_local_field_group( $field_group ) You can find these functions and more in the core/local.php file. Here is a list of functions which will be used in the examples below. ?? Note: Field Groups and Fields registered via code will not be visible/editable via the “Edit Field Groups” admin page. If 2 fields or 2 groups are added using the same key, the later will override the original. The key is a reference for ACF to find, save and load data. ?? Note: It is important to remember that each field group’s key and each field’s key must be unique.
ACF can even generate the PHP code for you from the Import / Export menu page within the WP dashboard! Getting startedĪdding field groups and fields is easy. If you only require a solution for distribution across multiple environments, please familiarize yourself with the local json feature as this solves the issue with minimal effort. It also reduces calls to the database and can speed up your website. The ability to define fields within the theme’s files allows developers to avoid any data loss when working across multiple environments (dev/staging/live). There are many benefits to using PHP to register fields, the main of which is customization and distribution. This article will discuss how to register fields and field groups via the functions.php file.