Skip to content

Instantly share code, notes, and snippets.

@pdewouters
Created May 2, 2012 10:31
Show Gist options
  • Select an option

  • Save pdewouters/2575769 to your computer and use it in GitHub Desktop.

Select an option

Save pdewouters/2575769 to your computer and use it in GitHub Desktop.
php export advanced custom fields
/**
* Activate Add-ons
* Here you can enter your activation codes to unlock Add-ons to use in your theme.
* Since all activation codes are multi-site licenses, you are allowed to include your key in premium themes.
* Use the commented out code to update the database with your activation code.
* You may place this code inside an IF statement that only runs on theme activation.
*/
// if(!get_option('acf_repeater_ac')) update_option('acf_repeater_ac', "xxxx-xxxx-xxxx-xxxx");
// if(!get_option('acf_options_ac')) update_option('acf_options_ac', "xxxx-xxxx-xxxx-xxxx");
// if(!get_option('acf_flexible_content_ac')) update_option('acf_flexible_content_ac', "xxxx-xxxx-xxxx-xxxx");
/**
* Register field groups
* The register_field_group function accepts 1 array which holds the relevant data to register a field group
* You may edit the array as you see fit. However, this may result in errors if the array is not compatible with ACF
* This code must run every time the functions.php file is read
*/
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => '4fa10cb7328cd',
'title' => 'Services',
'fields' =>
array (
0 =>
array (
'key' => 'field_4f9e80d0f3531',
'label' => 'Service',
'name' => 'service',
'type' => 'repeater',
'instructions' => '',
'required' => '1',
'sub_fields' =>
array (
0 =>
array (
'key' => 'field_4f9e815e3315c',
'label' => 'Service title',
'name' => 'service_title',
'type' => 'text',
'default_value' => '',
'formatting' => 'html',
'order_no' => '0',
),
1 =>
array (
'key' => 'field_4f9e815e33169',
'label' => 'Service description',
'name' => 'service_description',
'type' => 'wysiwyg',
'toolbar' => 'full',
'media_upload' => 'yes',
'order_no' => '1',
),
2 =>
array (
'key' => 'field_4f9e815e33173',
'label' => 'Service image',
'name' => 'service_image',
'type' => 'image',
'save_format' => 'id',
'preview_size' => 'thumbnail',
'order_no' => '2',
),
),
'row_limit' => '',
'layout' => 'table',
'button_label' => '+ Add Service',
'order_no' => '0',
),
),
'location' =>
array (
'rules' =>
array (
0 =>
array (
'param' => 'page',
'operator' => '==',
'value' => '16',
'order_no' => '0',
),
),
'allorany' => 'all',
),
'options' =>
array (
'position' => 'normal',
'layout' => 'default',
'show_on_page' =>
array (
),
),
'menu_order' => 0,
));
}
register_field_group(array (
'id' => '4fa10cb735baa',
'title' => 'Planning steps',
'fields' =>
array (
0 =>
array (
'key' => 'field_4f9e90078dcb8',
'label' => 'Step',
'name' => 'step',
'type' => 'repeater',
'instructions' => '',
'required' => '0',
'sub_fields' =>
array (
0 =>
array (
'key' => 'field_4f9e90078dccc',
'label' => 'Step title',
'name' => 'step_title',
'type' => 'text',
'default_value' => '',
'formatting' => 'html',
'order_no' => '0',
),
1 =>
array (
'key' => 'field_4f9e90078dcd9',
'label' => 'Step description',
'name' => 'step_description',
'type' => 'wysiwyg',
'toolbar' => 'full',
'media_upload' => 'yes',
'order_no' => '1',
),
),
'row_limit' => '',
'layout' => 'table',
'button_label' => '+ Add Step',
'order_no' => '0',
),
),
'location' =>
array (
'rules' =>
array (
0 =>
array (
'param' => 'page',
'operator' => '==',
'value' => '14',
'order_no' => '0',
),
),
'allorany' => 'all',
),
'options' =>
array (
'position' => 'normal',
'layout' => 'default',
'show_on_page' =>
array (
),
),
'menu_order' => 0,
));
}
register_field_group(array (
'id' => '4fa10cb73968e',
'title' => 'FAQ',
'fields' =>
array (
0 =>
array (
'key' => 'field_4f9fd6b424ebb',
'label' => 'FAQ Section',
'name' => 'faq_section',
'type' => 'repeater',
'instructions' => '',
'required' => '0',
'sub_fields' =>
array (
0 =>
array (
'key' => 'field_4f9fd710df5ba',
'label' => 'section title',
'name' => 'section_title',
'type' => 'text',
'default_value' => '',
'formatting' => 'html',
'order_no' => '0',
),
1 =>
array (
'key' => 'field_4f9fd6b424edb',
'label' => 'questions and answers',
'name' => 'q_a',
'type' => 'wysiwyg',
'toolbar' => 'full',
'media_upload' => 'yes',
'order_no' => '1',
),
),
'row_limit' => '',
'layout' => 'row',
'button_label' => '+ Add FAQ Section',
'order_no' => '0',
),
),
'location' =>
array (
'rules' =>
array (
0 =>
array (
'param' => 'page',
'operator' => '==',
'value' => '18',
'order_no' => '0',
),
),
'allorany' => 'all',
),
'options' =>
array (
'position' => 'normal',
'layout' => 'default',
'show_on_page' =>
array (
),
),
'menu_order' => 0,
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment