'acf_category-holder', 'title' => 'Category Holder', 'fields' => array ( array ( 'multiple' => 0, 'allow_null' => 1, 'choices' => array ( 'press-release' => 'Press Release', 'event' => 'Event', ), 'default_value' => '', 'key' => 'field_522da46c91bf2', 'label' => 'Category Holder', 'name' => 'category_holder', 'type' => 'select', 'instructions' => 'If this page should act as a holder page for a specific category, please enter the category name here.', ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'page', 'order_no' => 0, 'group_no' => 0, ), ), ), 'options' => array ( 'position' => 'normal', 'layout' => 'no_box', 'hide_on_screen' => array ( ), ), 'menu_order' => 0, )); } function my_acf_load_field( $field ) { // reset choices $field['choices'] = array(); // load repeater from the options page if($categories = get_categories()) { // loop through the repeater and use the sub fields "value" and "label" foreach($categories as $category) { $value = $category->slug; $label = $category->name; $field['choices'][ $value ] = $label; } } // Important: return the field return $field; } add_filter('acf/load_field/name=category_holder', 'my_acf_load_field'); // Other custom fields if(function_exists("register_field_group")) { register_field_group(array ( 'id' => 'acf_event', 'title' => 'Event', 'fields' => array ( array ( 'default_value' => '', 'formatting' => 'br', 'key' => 'field_51cdbbc3d8d31', 'label' => 'Event address', 'name' => 'event-address', 'type' => 'textarea', 'instructions' => 'Please enter the address to the venue here.', ), array ( 'default_value' => '', 'formatting' => 'br', 'key' => 'field_51cdbbead8d32', 'label' => 'Event contact info', 'name' => 'event-contact_info', 'type' => 'textarea', 'instructions' => 'Please enter any contact details and Phone Numbers here.', ), array ( 'key' => 'field_53d66111c3e26', 'label' => 'Event Attachment', 'name' => 'event_attachment', 'type' => 'repeater', 'instructions' => 'Upload your PDF files here.', 'sub_fields' => array ( array ( 'key' => 'field_53d6612cc3e27', 'label' => 'attachment title', 'name' => 'event_attachment_title', 'type' => 'text', 'instructions' => 'Please enter the title of your attachment (e.g "Registration Form." "Meeting minutes"', 'column_width' => '', 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'formatting' => 'html', 'maxlength' => '', ), array ( 'key' => 'field_53d66171c3e28', 'label' => 'event attachment', 'name' => 'event_attachment_file', 'type' => 'file', 'column_width' => '', 'save_format' => 'url', 'library' => 'all', ), ), 'row_min' => '', 'row_limit' => '', 'layout' => 'row', 'button_label' => 'Include an attachment', ), array ( 'default_value' => 0, 'message' => '', 'key' => 'field_51d1f82cf59b0', 'label' => 'Featured', 'name' => 'featured', 'type' => 'true_false', 'instructions' => 'Show event in the sidebar?', ), ), 'location' => array ( array ( array ( 'param' => 'post_category', 'operator' => '==', 'value' => $event_category_id, 'order_no' => 0, 'group_no' => 0, ), ), ), 'options' => array ( 'position' => 'normal', 'layout' => 'no_box', 'hide_on_screen' => array ( ), ), 'menu_order' => 0, )); register_field_group(array ( 'id' => 'acf_publication', 'title' => 'Publication', 'fields' => array ( array ( 'save_format' => 'url', 'library' => 'all', 'key' => 'field_51d0658621ed0', 'label' => 'Publication file', 'name' => 'publication-file', 'type' => 'file', 'instructions' => 'Upload your publication here, it will be made available for download on the site.', ), ), 'location' => array ( array ( array ( 'param' => 'post_category', 'operator' => '==', 'value' => $publication_category_id, 'order_no' => 0, 'group_no' => 0, ), ), ), 'options' => array ( 'position' => 'normal', 'layout' => 'no_box', 'hide_on_screen' => array ( ), ), 'menu_order' => 0, )); }