Skip to content

Instantly share code, notes, and snippets.

@jrstaatsiii
Created March 7, 2017 05:06
Show Gist options
  • Save jrstaatsiii/a99cc3f20422d0aaacce52417ce09dcf to your computer and use it in GitHub Desktop.
Save jrstaatsiii/a99cc3f20422d0aaacce52417ce09dcf to your computer and use it in GitHub Desktop.
{
"key": "group_5888f0f081f23",
"title": "Page Builder",
"fields": [
{
"key": "field_5888f0f5a2760",
"label": "Content Blocks",
"name": "content_blocks",
"type": "flexible_content",
"instructions": "<strong>Content Blocks<\/strong> are horizontal rows of content containing one or more columns.",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"button_label": "Add Content Block",
"min": "",
"max": "",
"layouts": [
{
"key": "5888f10e73937",
"name": "one_column",
"label": "Full Width",
"display": "block",
"sub_fields": [
{
"key": "field_5888f271afc78",
"label": "Content",
"name": "",
"type": "tab",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"placement": "top",
"endpoint": 0
},
{
"key": "field_5888f261afc77",
"label": "Header",
"name": "header",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_5888f18acf71d"
],
"prefix_label": 0,
"prefix_name": 0,
"display": "seamless",
"layout": "block"
},
{
"key": "field_5888f6c7a4ffa",
"label": "Full Width",
"name": "full_width_modules",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "hide-label",
"id": ""
},
"min": 1,
"max": 1,
"layout": "block",
"button_label": "",
"collapsed": "field_5893cc6ef5cc5",
"sub_fields": [
{
"key": "field_5893cc6ef5cc5",
"label": "Content",
"name": "",
"type": "tab",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"placement": "left",
"endpoint": 0
},
{
"key": "field_5888f8426d5cd",
"label": "Modules",
"name": "modules",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_5888f786b4448"
],
"prefix_label": 0,
"prefix_name": 0,
"display": "seamless",
"layout": "block"
},
{
"key": "field_5893cc81f5cc6",
"label": "Style",
"name": "",
"type": "tab",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"placement": "left",
"endpoint": 0
},
{
"key": "field_5893cc93f5cc7",
"label": "Style",
"name": "style",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_5888f1c9f30ca"
],
"prefix_label": 0,
"prefix_name": 0,
"display": "seamless",
"layout": "block"
}
]
},
{
"key": "field_5888f280afc79",
"label": "Style",
"name": "",
"type": "tab",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"placement": "top",
"endpoint": 0
},
{
"key": "field_58964790c181f",
"label": "Column Width",
"name": "column_width",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "column-widths",
"id": ""
},
"choices": {
"12": "<img class=\"layout-thumbs\" src=\"\/wp-content\/themes\/markitcreative\/src\/lib\/SSMPB\/images\/layout-thumbnails\/12.png\" alt=\"12\" width=\"100px\" height=\"auto\" style=\"border: 1px solid #ddd;\" \/>",
"8": "<img class=\"layout-thumbs\" src=\"\/wp-content\/themes\/markitcreative\/src\/lib\/SSMPB\/images\/layout-thumbnails\/8.png\" alt=\"8\" width=\"100px\" height=\"auto\" style=\"border: 1px solid #ddd;\" \/>"
},
"allow_null": 0,
"other_choice": 0,
"save_other_choice": 0,
"default_value": 8,
"layout": "horizontal",
"return_format": "value"
},
{
"key": "field_5888f293afc7a",
"label": "Style",
"name": "style",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_5888f1c9f30ca"
],
"prefix_label": 0,
"prefix_name": 0,
"display": "seamless",
"layout": "block"
},
{
"key": "field_588906dab64f4",
"label": "Admin",
"name": "",
"type": "tab",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"placement": "top",
"endpoint": 0
},
{
"key": "field_588906eab64f5",
"label": "Admin",
"name": "admin",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_588906a3b200b"
],
"prefix_label": 0,
"prefix_name": 0,
"display": "seamless",
"layout": "block"
}
],
"min": "",
"max": ""
},
]
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "client"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"modified": 1488859478
}
<?php
function ssm_load_full_width_column_choices( $sub_field ) {
// reset choices
$sub_field['choices'] = array();
$sub_field['choices'][ '12' ] = '<img src="' . SSMPB_DIR_URI . 'images/layout-thumbnails/12.png';
$sub_field['choices'][ '8' ] = '<img src="' . SSMPB_DIR_URI . 'images/layout-thumbnails/8.png';
// return the field
return $sub_field;
}
/**
* Load Image Thumbnails on Full Width Layout
*/
add_filter('acf/load_field/name=content_blocks-one_column-column_width', 'ssm_load_full_width_column_choices');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment