Last active
August 1, 2021 17:05
-
-
Save E-VANCE/7ec408b257c015e444b11d284f565276 to your computer and use it in GitHub Desktop.
ACF Builder (Home fields)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* HOME -- Slider | |
*/ | |
$home_slider = new FieldsBuilder('home_slider'); | |
$home_slider | |
->addRepeater('slider', ['min' => 1, 'max' => 5, 'layout' => 'table']) | |
->addImage('image') | |
->addText('title', [ | |
'wp-typography' => 'content' | |
]) | |
->addWysiwyg('text', [ | |
'wp-typography' => 'content' | |
]) | |
->endRepeater() | |
->addText('claim'); | |
/** | |
* HOME -- CTAs with icons | |
*/ | |
$home_cta_icons = new FieldsBuilder('home_cta_icons'); | |
$home_cta_icons | |
->addRepeater('icons', ['min' => 1, 'max' => 3, 'layout' => 'table']) | |
->addImage('icon') | |
->addText('text', [ | |
'wp-typography' => 'content' | |
]) | |
->addLink('button') | |
->endRepeater(); | |
/** | |
* HOME -- Numbers / statistics | |
*/ | |
$home_stats = new FieldsBuilder('home_stats'); | |
$home_stats | |
->addRepeater('stats', ['min' => 1, 'max' => 3, 'layout' => 'table']) | |
->addText('number') | |
->addWysiwyg('text', [ | |
'wp-typography' => 'content', | |
'delay' => 1 | |
]) | |
->endRepeater(); | |
/** | |
* HOME -- About-Section | |
*/ | |
$home_about = new FieldsBuilder('home_about'); | |
$home_about | |
->addImage('image') | |
->addText('title') | |
->addWysiwyg('text', [ | |
'wp-typography' => 'content', | |
'delay' => 1 | |
]); | |
/** | |
* HOME -- Videos | |
*/ | |
$home_videos = new FieldsBuilder('home_videos'); | |
$home_videos | |
->addImage('background_image') | |
->addRepeater('videos', ['min' => 1, 'max' => 5, 'layout' => 'table']) | |
->addOembed('source') | |
->addText('title', [ | |
'wp-typography' => 'content' | |
]) | |
->endRepeater(); | |
/** | |
* HOME -- Trust logos | |
*/ | |
$home_logos = new FieldsBuilder('home_logos'); | |
$home_logos | |
->addRepeater('logos', ['min' => 1, 'max' => 9, 'layout' => 'table']) | |
->addImage('logo') | |
->endRepeater(); | |
/** | |
* HOME MASTER -- All home fields tabbed together | |
*/ | |
$home = new FieldsBuilder('home'); | |
$home | |
->addTab('Slider') | |
->addFields($home_slider) | |
->addTab('CTA Icons') | |
->addFields($home_cta_icons) | |
->addTab('Stats') | |
->addFields($home_stats) | |
->addTab('About') | |
->addFields($home_about) | |
->addTab('Videos') | |
->addFields($home_videos) | |
->addTab('Logos') | |
->addFields($home_logos) | |
->setLocation('page_type', '==', 'front_page'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hhj