This repository has been archived by the owner on Jun 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Naming conventions & modularity
Koen edited this page Aug 1, 2019
·
3 revisions
We follow a strict naming convention, depending on where the field group is linked to:
-
Block › <Name>
: used for blocks which are cloned in flexible content -
Page › <Type>
: used for groups linked toFront Page
orPosts
-
Partial › <Name>
: used for partials which are cloned inside other groups -
Post Type › <Name>
: used for post types -
Option › <Name>
: used for (theme) option pages -
Template › <Name>
: used for custom page templates
We try to keep our field groups DRY. This means that if there's shared functionality between groups, it's probably better to create a partial for it. This way you can clone it into the groups using the fields, and you only need to update it once.
An example:
If you have a button that's used in multiple groups, it's probably better to create field group called
Partial › Button
. In it you might have alabel
,link
andstyle
.You can then add a
clone
field calledbutton
to the groups needing it. This will make all inputs available for usage there. You can access fields in the template in two ways:button.field
orbutton_field
See also:
- Clone in the ACF documentation