Skip to content

Instantly share code, notes, and snippets.

@loulou2u
Last active August 29, 2015 14:22
Show Gist options
  • Save loulou2u/c9363ba8ad8d83f9e484 to your computer and use it in GitHub Desktop.
Save loulou2u/c9363ba8ad8d83f9e484 to your computer and use it in GitHub Desktop.
Code generated by Advanced Custom Fields plugin at add custom fields to page/post editors
// Calendar (3 events): Show three LiveWhale Calendar events in a horizontal row
// Below is the resulting code, which you can roll into the master functions.php if you want it to apply to all themes in a multisite site.
register_field_group(array (
'id' => 'acf_calendar-3-events',
'title' => 'Calendar (3 events)',
'fields' => array (
array (
'key' => 'field_53d14e3d55dba',
'label' => 'Show events?',
'name' => 'show_three_events',
'type' => 'true_false',
'instructions' => 'Show three upcoming events from the Calendar?',
'message' => '',
'default_value' => 0,
),
array (
'key' => 'field_53d14e8f55dbb',
'label' => 'Event source:',
'name' => 'groups',
'type' => 'radio',
'instructions' => 'You can show your group\'s events, all events, or events from another group.',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_53d14e3d55dba',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'choices' => array (
get_blog_details()->blogname => 'My group',
'all' => 'All events',
),
'other_choice' => 1,
'save_other_choice' => 1,
'default_value' => '',
'layout' => 'vertical',
),
array (
'key' => 'field_53d14eec55dbc',
'label' => 'Show events by tag',
'name' => 'tags',
'type' => 'text',
'instructions' => 'Only show events with this tag or tags. If you use more than one tag, separate tags with commas. (Optional)',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_53d14e3d55dba',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'none',
'maxlength' => '',
),
),
'location' => array (
array (
array (
'param' => 'page_template',
'operator' => '==',
'value' => 'page_template-with-extras.php',
'order_no' => 0,
'group_no' => 0,
),
),
),
'options' => array (
'position' => 'normal',
'layout' => 'default',
'hide_on_screen' => array (
),
),
'menu_order' => 0,
));
// Calendar (Event list): Show between 1 and 5 upcoming events from LiveWhale Calendar
register_field_group(array (
'id' => 'acf_calendar-event-list',
'title' => 'Calendar: Event list',
'fields' => array (
array (
'key' => 'field_53d14b6c215a6',
'label' => 'Show an event?',
'name' => 'show_event_list',
'type' => 'true_false',
'instructions' => 'Show an upcoming event from the Calendar?',
'message' => '',
'default_value' => 0,
),
array (
'key' => 'field_53d14b95215a7',
'label' => 'Event source:',
'name' => 'groups',
'type' => 'radio',
'instructions' => 'You can show your group\'s events, all events, or events from another group (requires entering the group\'s LiveWhale Calendar group name).',
'required' => 1,
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_53d14b6c215a6',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'choices' => array (
get_blog_details()->blogname => 'My group',
'all' => 'All events',
),
'other_choice' => 1,
'save_other_choice' => 1,
'default_value' => '',
'layout' => 'vertical',
),
array (
'key' => 'field_53d14c4c215a8',
'label' => 'Show events by tag',
'name' => 'tags',
'type' => 'text',
'instructions' => 'Only show events with this tag or tags. If you use more than one tag, separate tags with commas. (Optional)',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_53d14b6c215a6',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'none',
'maxlength' => '',
),
array (
'key' => 'field_53d1930b15e56',
'label' => 'How many events?',
'name' => 'max_events',
'type' => 'select',
'instructions' => 'The maximum number of events that will show up in your list.',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_53d14b6c215a6',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'choices' => array (
1 => 1,
2 => 2,
3 => 3,
4 => 4,
5 => 5,
),
'default_value' => '',
'allow_null' => 0,
'multiple' => 0,
),
),
'location' => array (
array (
array (
'param' => 'page_template',
'operator' => '==',
'value' => 'page_landing-page-with-gallery-template.php',
'order_no' => 0,
'group_no' => 1,
),
),
),
'options' => array (
'position' => 'side',
'layout' => 'default',
'hide_on_screen' => array (
),
),
'menu_order' => 0,
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment