Last active
December 14, 2019 08:28
-
-
Save E-VANCE/089ccc1cc3d7dd47e2458835e6ca54cc to your computer and use it in GitHub Desktop.
ACF Builder (Basic 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 | |
/** | |
* BASIC -- Header image | |
*/ | |
$basic_page_header = new FieldsBuilder('basic_page_header'); | |
$basic_page_header | |
->addImage('page_header_background_image') | |
->addText('page_header_title', [ | |
'instructions' => 'Leave empty to use the site title / name', | |
'wp-typography' => 'content' | |
]) | |
->addText('page_header_subtitle', [ | |
'wp-typography' => 'content' | |
]) | |
->addWysiwyg('page_header_alert_bar', [ | |
'delay' => 1 | |
]); | |
/** | |
* BASIC -- Info box | |
*/ | |
$basic_info_box = new FieldsBuilder('basic_info_box'); | |
$basic_info_box | |
->addTrueFalse('info_box_width', [ | |
'instructions' => 'Activate for full width', | |
'ui' => 1 | |
]) | |
->addImage('info_box_background_image') | |
->addText('info_box_title', [ | |
'wp-typography' => 'content' | |
]) | |
->addText('info_box_subtitle', [ | |
'wp-typography' => 'content' | |
]) | |
->addTextarea('info_box_text', [ | |
'wp-typography' => 'content' | |
]) | |
->setLocation('page_type', '!=', 'front_page'); | |
/** | |
* BASIC -- CTA / Call to action | |
*/ | |
$basic_cta = new FieldsBuilder('basic_cta'); | |
$basic_cta | |
->addTrueFalse('cta_active') | |
->setConfig('ui', 1) | |
->addText('cta_title', [ | |
'wp-typography' => 'content' | |
]) | |
->addText('cta_subtitle', [ | |
'wp-typography' => 'content' | |
]) | |
->addLink('cta_button') | |
->addRadio('cta_style') | |
->addChoices('light', 'dark', 'white') | |
->setDefaultValue('light') | |
->addRadio('cta_positon') | |
->addChoices(['float' => 'Nebeneinander'], ['break' => 'Untereinander']) | |
->setDefaultValue('float'); | |
/** | |
* BASIC MASTER -- All basic fields tabbed together | |
*/ | |
$basic = new FieldsBuilder('basic'); | |
$basic | |
->addTab('Header') | |
->addFields($basic_page_header) | |
->addTab('Info Box') | |
->addFields($basic_info_box) | |
->addTab('CTA') | |
->addFields($basic_cta) | |
->setLocation('post_type', '==', 'page') | |
->and('page_template', '!=', 'views/template-redirection.blade.php'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment