-
Notifications
You must be signed in to change notification settings - Fork 62
Using
Steve Pfisterer edited this page Jun 6, 2016
·
2 revisions
The quickest way to use ACF Builder is to require the autoload.php file (Composer's auto generated vendor/autoload.php or ACF Builder's custom autoload.php file) in your functions.php code. If your theme is set up to use composer, no require is needed.
Create new FieldsBuilder objects to create ACF groups, and setLocation
to where you want them to show up in the admin.
Use ACF's built in actions to register the field group config with ACF.
$banner = new StoutLogic\AcfBuilder\FieldsBuilder('banner');
$banner
->addText('title')
->addWysiwyg('content')
->addImage('background_image')
->setLocation('post_type', '==', 'page')
->or('post_type', '==', 'post');
add_action('acf/init', function() use ($banner) {
acf_add_local_field_group($banner->build());
});
Want to contribute to this Wiki? Fork it and send a pull request.
© Stout Logic, LLC