Last active
September 30, 2016 07:23
-
-
Save michaelwilhelmsen/5b98c705bbbd3142166a78e97c4fc2a9 to your computer and use it in GitHub Desktop.
ACF Simple Flexible Content Page Builder
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
| [ | |
| { | |
| "key": "group_57d2ab81d5362", | |
| "title": "Page Builder", | |
| "fields": [ | |
| { | |
| "key": "field_57d2abe0157fc", | |
| "label": "Content", | |
| "name": "content", | |
| "type": "flexible_content", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "button_label": "Add Content", | |
| "min": "", | |
| "max": "", | |
| "layouts": [ | |
| { | |
| "key": "57d2abefa7908", | |
| "name": "1_column", | |
| "label": "1 Column", | |
| "display": "block", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57d2ac0b157fd", | |
| "label": "Column Content", | |
| "name": "column_content", | |
| "type": "repeater", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "collapsed": "", | |
| "min": "", | |
| "max": "", | |
| "layout": "block", | |
| "button_label": "Add Column Content", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57d2acf6157fe", | |
| "label": "Wysiwyg Editor", | |
| "name": "wysiwyg_editor", | |
| "type": "wysiwyg", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "default_value": "", | |
| "tabs": "all", | |
| "toolbar": "full", | |
| "media_upload": 1 | |
| } | |
| ] | |
| } | |
| ], | |
| "min": "", | |
| "max": "" | |
| }, | |
| { | |
| "key": "57d2ad3d157ff", | |
| "name": "2_columns", | |
| "label": "2 Columns", | |
| "display": "block", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57d2ad4615800", | |
| "label": "Left Column Content", | |
| "name": "left_column_content", | |
| "type": "repeater", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "collapsed": "", | |
| "min": "", | |
| "max": "", | |
| "layout": "block", | |
| "button_label": "Add Column Content", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57d2ad5a15801", | |
| "label": "Wysiwyg Editor", | |
| "name": "wysiwyg_editor", | |
| "type": "wysiwyg", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "default_value": "", | |
| "tabs": "all", | |
| "toolbar": "full", | |
| "media_upload": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "key": "field_57d2ad9015802", | |
| "label": "Right Column Content", | |
| "name": "right_column_content", | |
| "type": "repeater", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "collapsed": "", | |
| "min": "", | |
| "max": "", | |
| "layout": "block", | |
| "button_label": "Add Column Content", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57d2ad9015803", | |
| "label": "Wysiwyg Editor", | |
| "name": "wysiwyg_editor", | |
| "type": "wysiwyg", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "default_value": "", | |
| "tabs": "all", | |
| "toolbar": "full", | |
| "media_upload": 1 | |
| } | |
| ] | |
| } | |
| ], | |
| "min": "", | |
| "max": "" | |
| }, | |
| { | |
| "key": "57e4f027f3764", | |
| "name": "2_columns_1_third_2_thirds", | |
| "label": "2 Columns (1\/3 and 2\/3)", | |
| "display": "block", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57e4f027f3765", | |
| "label": "Left Column Content", | |
| "name": "left_column_content", | |
| "type": "repeater", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "collapsed": "", | |
| "min": "", | |
| "max": "", | |
| "layout": "block", | |
| "button_label": "Add Column Content", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57e4f027f3766", | |
| "label": "Wysiwyg Editor", | |
| "name": "wysiwyg_editor", | |
| "type": "wysiwyg", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "default_value": "", | |
| "tabs": "all", | |
| "toolbar": "full", | |
| "media_upload": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "key": "field_57e4f027f3767", | |
| "label": "Right Column Content", | |
| "name": "right_column_content", | |
| "type": "repeater", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "collapsed": "", | |
| "min": "", | |
| "max": "", | |
| "layout": "block", | |
| "button_label": "Add Column Content", | |
| "sub_fields": [ | |
| { | |
| "key": "field_57e4f027f3768", | |
| "label": "Wysiwyg Editor", | |
| "name": "wysiwyg_editor", | |
| "type": "wysiwyg", | |
| "instructions": "", | |
| "required": 0, | |
| "conditional_logic": 0, | |
| "wrapper": { | |
| "width": "", | |
| "class": "", | |
| "id": "" | |
| }, | |
| "default_value": "", | |
| "tabs": "all", | |
| "toolbar": "full", | |
| "media_upload": 1 | |
| } | |
| ] | |
| } | |
| ], | |
| "min": "", | |
| "max": "" | |
| } | |
| ] | |
| } | |
| ], | |
| "location": [ | |
| [ | |
| { | |
| "param": "post_type", | |
| "operator": "==", | |
| "value": "page" | |
| } | |
| ] | |
| ], | |
| "menu_order": 0, | |
| "position": "normal", | |
| "style": "default", | |
| "label_placement": "top", | |
| "instruction_placement": "label", | |
| "hide_on_screen": "", | |
| "active": 1, | |
| "description": "" | |
| } | |
| ] |
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 | |
| /******************** | |
| * PAGE BUILDER | |
| ********************/ | |
| ?> | |
| <?php | |
| if( have_rows('content') ): | |
| while ( have_rows('content') ) : the_row(); | |
| // 1 COLUMN | |
| if( get_row_layout() == '1_column' ): | |
| echo '<section class="one-col cf">'; | |
| // COLUMN CONTENT | |
| if( have_rows('column_content') ): | |
| echo '<div class="m-all t-all d-all builder-content cf">'; | |
| while ( have_rows('column_content') ) : the_row(); | |
| // WYSIWYG EDITOR | |
| the_sub_field('wysiwyg_editor'); | |
| endwhile; | |
| echo '</div>'; | |
| else : | |
| endif; | |
| echo '</section>'; | |
| // 2 COLUMNS | |
| elseif( get_row_layout() == '2_columns' ): | |
| echo '<section class="two-col grid-skin cf">'; | |
| // LEFT COLUMN CONTENT | |
| if( have_rows('left_column_content') ): | |
| echo '<div class="m-all mt-1of2 t-all d-1of2 with-padding builder-content cf">'; | |
| while ( have_rows('left_column_content') ) : the_row(); | |
| // WYSIWYG EDITOR | |
| the_sub_field('wysiwyg_editor'); | |
| endwhile; | |
| echo '</div>'; | |
| else : | |
| endif; | |
| // RIGHT COLUMN CONTENT | |
| if( have_rows('right_column_content') ): | |
| echo '<div class="m-all mt-1of2 t-all d-1of2 with-padding builder-content cf">'; | |
| while ( have_rows('right_column_content') ) : the_row(); | |
| // WYSIWYG EDITOR | |
| the_sub_field('wysiwyg_editor'); | |
| endwhile; | |
| echo '</div>'; | |
| else : | |
| endif; | |
| echo '</section>'; | |
| // 2 COLUMNS | |
| elseif( get_row_layout() == '2_columns_1_third_2_thirds' ): | |
| echo '<section class="two-col grid-skin cf">'; | |
| // LEFT COLUMN CONTENT | |
| if( have_rows('left_column_content') ): | |
| echo '<div class="m-all mt-all t-all d-1of3 with-padding builder-content cf">'; | |
| while ( have_rows('left_column_content') ) : the_row(); | |
| // WYSIWYG EDITOR | |
| the_sub_field('wysiwyg_editor'); | |
| endwhile; | |
| echo '</div>'; | |
| else : | |
| endif; | |
| // RIGHT COLUMN CONTENT | |
| if( have_rows('right_column_content') ): | |
| echo '<div class="m-all mt-all t-all d-2of3 with-padding builder-content cf">'; | |
| while ( have_rows('right_column_content') ) : the_row(); | |
| // WYSIWYG EDITOR | |
| the_sub_field('wysiwyg_editor'); | |
| endwhile; | |
| echo '</div>'; | |
| else : | |
| endif; | |
| echo '</section>'; | |
| endif; | |
| endwhile; | |
| else : | |
| // no layouts found | |
| endif; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment