diff --git a/wp-content/themes/bitwms-child/functions.php b/wp-content/themes/bitwms-child/functions.php index 829ccf7..84a367d 100644 --- a/wp-content/themes/bitwms-child/functions.php +++ b/wp-content/themes/bitwms-child/functions.php @@ -44,6 +44,7 @@ function bitwms_child_enqueue_styles() { $bitwms_includes = array( 'inc/enqueue.php', 'inc/cpt.php', + 'inc/acf-fields.php', ); foreach ( $bitwms_includes as $bitwms_file ) { diff --git a/wp-content/themes/bitwms-child/inc/acf-fields.php b/wp-content/themes/bitwms-child/inc/acf-fields.php new file mode 100644 index 0000000..d9bc803 --- /dev/null +++ b/wp-content/themes/bitwms-child/inc/acf-fields.php @@ -0,0 +1,325 @@ + 'group_case_fields', + 'title' => 'Поля кейса', + 'fields' => array( + array( + 'key' => 'field_case_client', + 'label' => 'Клиент', + 'name' => 'case_client', + 'type' => 'text', + 'required' => 1, + ), + array( + 'key' => 'field_case_industry', + 'label' => 'Отрасль', + 'name' => 'case_industry', + 'type' => 'text', + ), + array( + 'key' => 'field_case_task', + 'label' => 'Задача', + 'name' => 'case_task', + 'type' => 'wysiwyg', + 'toolbar' => 'basic', + ), + array( + 'key' => 'field_case_solution', + 'label' => 'Решение', + 'name' => 'case_solution', + 'type' => 'wysiwyg', + 'toolbar' => 'basic', + ), + array( + 'key' => 'field_case_result', + 'label' => 'Результат', + 'name' => 'case_result', + 'type' => 'wysiwyg', + 'toolbar' => 'basic', + ), + array( + 'key' => 'field_case_quote', + 'label' => 'Цитата', + 'name' => 'case_quote', + 'type' => 'textarea', + 'rows' => 3, + ), + array( + 'key' => 'field_case_gallery', + 'label' => 'Галерея', + 'name' => 'case_gallery', + 'type' => 'gallery', + 'return_format' => 'array', + ), + ), + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'case', + ), + ), + ), + ) ); + + // ------------------------------------------------------------------------- + // 2. Вебинары (webinar) + // ------------------------------------------------------------------------- + + acf_add_local_field_group( array( + 'key' => 'group_webinar_fields', + 'title' => 'Поля вебинара', + 'fields' => array( + array( + 'key' => 'field_webinar_date', + 'label' => 'Дата и время', + 'name' => 'webinar_date', + 'type' => 'date_time_picker', + 'required' => 1, + 'display_format' => 'd.m.Y H:i', + 'return_format' => 'Y-m-d H:i:s', + ), + array( + 'key' => 'field_webinar_speaker', + 'label' => 'Спикер', + 'name' => 'webinar_speaker', + 'type' => 'text', + ), + array( + 'key' => 'field_webinar_status', + 'label' => 'Статус', + 'name' => 'webinar_status', + 'type' => 'select', + 'choices' => array( + 'upcoming' => 'Анонс', + 'past' => 'Прошёл', + ), + 'default_value' => 'upcoming', + ), + array( + 'key' => 'field_webinar_video', + 'label' => 'Видеозапись', + 'name' => 'webinar_video', + 'type' => 'url', + 'conditional_logic' => array( + array( + array( + 'field' => 'field_webinar_status', + 'operator' => '==', + 'value' => 'past', + ), + ), + ), + ), + array( + 'key' => 'field_webinar_presentation', + 'label' => 'Презентация', + 'name' => 'webinar_presentation', + 'type' => 'file', + 'return_format' => 'url', + 'conditional_logic' => array( + array( + array( + 'field' => 'field_webinar_status', + 'operator' => '==', + 'value' => 'past', + ), + ), + ), + ), + ), + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'webinar', + ), + ), + ), + ) ); + + // ------------------------------------------------------------------------- + // 3. Курсы (course) + // ------------------------------------------------------------------------- + + acf_add_local_field_group( array( + 'key' => 'group_course_fields', + 'title' => 'Поля курса', + 'fields' => array( + array( + 'key' => 'field_course_program', + 'label' => 'Программа', + 'name' => 'course_program', + 'type' => 'wysiwyg', + 'toolbar' => 'full', + ), + array( + 'key' => 'field_course_duration', + 'label' => 'Длительность', + 'name' => 'course_duration', + 'type' => 'text', + 'placeholder' => 'Например: 2 дня (16 часов)', + ), + array( + 'key' => 'field_course_format', + 'label' => 'Формат', + 'name' => 'course_format', + 'type' => 'select', + 'choices' => array( + 'online' => 'Онлайн', + 'offline' => 'Очно', + 'mixed' => 'Смешанный', + ), + ), + array( + 'key' => 'field_course_price', + 'label' => 'Цена', + 'name' => 'course_price', + 'type' => 'text', + 'placeholder' => 'Например: 25 000 руб.', + ), + ), + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'course', + ), + ), + ), + ) ); + + // ------------------------------------------------------------------------- + // 4. Мероприятия (event) + // ------------------------------------------------------------------------- + + acf_add_local_field_group( array( + 'key' => 'group_event_fields', + 'title' => 'Поля мероприятия', + 'fields' => array( + array( + 'key' => 'field_event_date', + 'label' => 'Дата и время', + 'name' => 'event_date', + 'type' => 'date_time_picker', + 'required' => 1, + 'display_format' => 'd.m.Y H:i', + 'return_format' => 'Y-m-d H:i:s', + ), + array( + 'key' => 'field_event_location', + 'label' => 'Место проведения', + 'name' => 'event_location', + 'type' => 'text', + ), + array( + 'key' => 'field_event_format', + 'label' => 'Формат', + 'name' => 'event_format', + 'type' => 'select', + 'choices' => array( + 'online' => 'Онлайн', + 'offline' => 'Очно', + 'mixed' => 'Смешанный', + ), + ), + array( + 'key' => 'field_event_program', + 'label' => 'Программа', + 'name' => 'event_program', + 'type' => 'wysiwyg', + 'toolbar' => 'basic', + ), + array( + 'key' => 'field_event_registration_url', + 'label' => 'Ссылка на регистрацию', + 'name' => 'event_registration_url', + 'type' => 'url', + ), + ), + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'event', + ), + ), + ), + ) ); + + // ------------------------------------------------------------------------- + // 5. Материалы (material) + // ------------------------------------------------------------------------- + + acf_add_local_field_group( array( + 'key' => 'group_material_fields', + 'title' => 'Поля материала', + 'fields' => array( + array( + 'key' => 'field_material_file', + 'label' => 'Файл', + 'name' => 'material_file', + 'type' => 'file', + 'return_format' => 'array', + ), + array( + 'key' => 'field_material_file_type', + 'label' => 'Тип файла', + 'name' => 'material_file_type', + 'type' => 'select', + 'choices' => array( + 'pdf' => 'PDF', + 'video' => 'Видео', + 'checklist' => 'Чек-лист', + 'excel' => 'Excel', + 'other' => 'Другое', + ), + ), + array( + 'key' => 'field_material_gated', + 'label' => 'Закрытый доступ', + 'name' => 'material_gated', + 'type' => 'true_false', + 'default_value' => 0, + 'ui' => 1, + ), + ), + 'location' => array( + array( + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'material', + ), + ), + ), + ) ); +}