diff --git a/wp-content/themes/bitwms-child/functions.php b/wp-content/themes/bitwms-child/functions.php index 2215fe2..829ccf7 100644 --- a/wp-content/themes/bitwms-child/functions.php +++ b/wp-content/themes/bitwms-child/functions.php @@ -43,6 +43,7 @@ function bitwms_child_enqueue_styles() { $bitwms_includes = array( 'inc/enqueue.php', + 'inc/cpt.php', ); foreach ( $bitwms_includes as $bitwms_file ) { @@ -60,3 +61,11 @@ unset( $bitwms_file, $bitwms_path ); add_action( 'generate_before_header', function () { get_template_part( 'templates/sidebar-nav' ); } ); + +// --------------------------------------------------------------------------- +// 4. Inject top header bar (priority 20 — after sidebar at default/10) +// --------------------------------------------------------------------------- + +add_action( 'generate_before_header', function () { + get_template_part( 'templates/top-header' ); +}, 20 ); diff --git a/wp-content/themes/bitwms-child/inc/cpt.php b/wp-content/themes/bitwms-child/inc/cpt.php new file mode 100644 index 0000000..a7bc1ab --- /dev/null +++ b/wp-content/themes/bitwms-child/inc/cpt.php @@ -0,0 +1,195 @@ + array( + 'name' => 'Кейсы', + 'singular_name' => 'Кейс', + 'add_new' => 'Добавить кейс', + 'add_new_item' => 'Добавить новый кейс', + 'edit_item' => 'Редактировать кейс', + 'view_item' => 'Просмотреть кейс', + 'all_items' => 'Все кейсы', + 'search_items' => 'Найти кейс', + 'not_found' => 'Кейсы не найдены', + 'not_found_in_trash' => 'В корзине кейсов нет', + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-portfolio', + 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ), + 'rewrite' => array( 'slug' => 'cases' ), + ) ); + + // ----------------------------------------------------------------------- + // 2. Вебинары (webinar) + // ----------------------------------------------------------------------- + register_post_type( 'webinar', array( + 'labels' => array( + 'name' => 'Вебинары', + 'singular_name' => 'Вебинар', + 'add_new' => 'Добавить вебинар', + 'add_new_item' => 'Добавить новый вебинар', + 'edit_item' => 'Редактировать вебинар', + 'view_item' => 'Просмотреть вебинар', + 'all_items' => 'Все вебинары', + 'search_items' => 'Найти вебинар', + 'not_found' => 'Вебинары не найдены', + 'not_found_in_trash' => 'В корзине вебинаров нет', + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-video-alt3', + 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ), + 'rewrite' => array( 'slug' => 'webinars' ), + ) ); + + // ----------------------------------------------------------------------- + // 3. Курсы (course) + // ----------------------------------------------------------------------- + register_post_type( 'course', array( + 'labels' => array( + 'name' => 'Курсы', + 'singular_name' => 'Курс', + 'add_new' => 'Добавить курс', + 'add_new_item' => 'Добавить новый курс', + 'edit_item' => 'Редактировать курс', + 'view_item' => 'Просмотреть курс', + 'all_items' => 'Все курсы', + 'search_items' => 'Найти курс', + 'not_found' => 'Курсы не найдены', + 'not_found_in_trash' => 'В корзине курсов нет', + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-welcome-learn-more', + 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ), + 'rewrite' => array( 'slug' => 'courses' ), + ) ); + + // ----------------------------------------------------------------------- + // 4. Мероприятия (event) + // ----------------------------------------------------------------------- + register_post_type( 'event', array( + 'labels' => array( + 'name' => 'Мероприятия', + 'singular_name' => 'Мероприятие', + 'add_new' => 'Добавить мероприятие', + 'add_new_item' => 'Добавить новое мероприятие', + 'edit_item' => 'Редактировать мероприятие', + 'view_item' => 'Просмотреть мероприятие', + 'all_items' => 'Все мероприятия', + 'search_items' => 'Найти мероприятие', + 'not_found' => 'Мероприятия не найдены', + 'not_found_in_trash' => 'В корзине мероприятий нет', + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-calendar-alt', + 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ), + 'rewrite' => array( 'slug' => 'events' ), + ) ); + + // ----------------------------------------------------------------------- + // 5. Материалы (material) — no 'editor' support + // ----------------------------------------------------------------------- + register_post_type( 'material', array( + 'labels' => array( + 'name' => 'Материалы', + 'singular_name' => 'Материал', + 'add_new' => 'Добавить материал', + 'add_new_item' => 'Добавить новый материал', + 'edit_item' => 'Редактировать материал', + 'view_item' => 'Просмотреть материал', + 'all_items' => 'Все материалы', + 'search_items' => 'Найти материал', + 'not_found' => 'Материалы не найдены', + 'not_found_in_trash' => 'В корзине материалов нет', + ), + 'public' => true, + 'has_archive' => true, + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-download', + 'supports' => array( 'title', 'thumbnail', 'excerpt' ), + 'rewrite' => array( 'slug' => 'materials' ), + ) ); +} + +add_action( 'init', 'bitwms_register_taxonomies' ); + +/** + * Register custom taxonomies. + */ +function bitwms_register_taxonomies() { + + // ----------------------------------------------------------------------- + // 1. Отрасли (industry) — for case CPT, hierarchical + // ----------------------------------------------------------------------- + register_taxonomy( 'industry', array( 'case' ), array( + 'labels' => array( + 'name' => 'Отрасли', + 'singular_name' => 'Отрасль', + 'search_items' => 'Найти отрасль', + 'all_items' => 'Все отрасли', + 'parent_item' => 'Родительская отрасль', + 'parent_item_colon' => 'Родительская отрасль:', + 'edit_item' => 'Редактировать отрасль', + 'update_item' => 'Обновить отрасль', + 'add_new_item' => 'Добавить новую отрасль', + 'new_item_name' => 'Название новой отрасли', + 'menu_name' => 'Отрасли', + ), + 'hierarchical' => true, + 'public' => true, + 'show_in_rest' => true, + 'rewrite' => array( 'slug' => 'industry' ), + ) ); + + // ----------------------------------------------------------------------- + // 2. Тип материала (material_type) — for material CPT, hierarchical + // ----------------------------------------------------------------------- + register_taxonomy( 'material_type', array( 'material' ), array( + 'labels' => array( + 'name' => 'Типы материалов', + 'singular_name' => 'Тип материала', + 'search_items' => 'Найти тип материала', + 'all_items' => 'Все типы материалов', + 'parent_item' => 'Родительский тип', + 'parent_item_colon' => 'Родительский тип:', + 'edit_item' => 'Редактировать тип', + 'update_item' => 'Обновить тип', + 'add_new_item' => 'Добавить новый тип', + 'new_item_name' => 'Название нового типа', + 'menu_name' => 'Тип материала', + ), + 'hierarchical' => true, + 'public' => true, + 'show_in_rest' => true, + 'rewrite' => array( 'slug' => 'material-type' ), + ) ); +}