Александр Юрченко
Ответы в темах
Просмотр 2 ответов — с 1 по 2 (всего 2)
-
Форум: Проблемы и решения
Тема: Удалить пункт «Меню» из кастомайзераРазобрался, забыл добавить приоритет. В таком виде все отлично работает:
add_action( 'customize_register', static function ( WP_Customize_Manager $wp_customize ) { $wp_customize->remove_section( 'static_front_page' ); $wp_customize->remove_section( 'background_image' ); $wp_customize->remove_section( 'header_image' ); $wp_customize->remove_section( 'installed_themes' ); $wp_customize->remove_section( 'wporg_themes' ); $wp_customize->remove_section( 'custom_css' ); $wp_customize->remove_section( 'colors' ); $wp_customize->remove_control( 'site_icon' ); $wp_customize->remove_panel( 'nav_menus' ); }, 999 );
Форум: Проблемы и решения
Тема: Произвольные типы записейСовсем забыл, на всякий случай прикреплю код с регистрацией таксономий и типа записи (может в них напортачил)
Регистрация произвольного типа записи
add_action('init', 'post_types_events'); function post_types_events() { register_post_type('events', array( 'label' => '', 'labels' => array( 'name' => 'События', 'singular_name' => 'Событие', 'add_new' => 'Добавить событие', 'add_new_item' => 'Добавление события', 'edit_item' => 'Редактировать событие', 'new_item' => 'Новое событие', 'view_item' => 'Смотреть событие', 'search_items' => 'Искать события', 'not_found' => 'Не найдено', 'not_found_in_trash' => 'Не найдено в корзине', 'parent_item_colon' => '', 'menu_name' => 'События', ), 'description' => 'Календарь событий на WordPress', 'public' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-calendar-alt', 'hierarchical' => true, 'query_var' => true, 'supports' => array('title', 'custom-fields'), 'has_archive' => true, 'rewrite' => true, 'taxonomies' => array('calendars', 'cities'), )); }
Регистрация таксономии «Календари»
add_action('init', 'calendars_event_taxonomy'); function calendars_event_taxonomy() { register_taxonomy('calendars', array('events'), array( 'label' => '', 'labels' => array( 'name' => 'Календари', 'singular_name' => 'Календарь', 'search_items' => 'Искать календарь', 'all_items' => 'Все календари', 'view_item ' => 'Смотреть календарь', 'parent_item' => 'Родительский календарь', 'parent_item_colon' => 'Родительский календарь:', 'edit_item' => 'Редактировать календарь', 'update_item' => 'Обновить календарь', 'add_new_item' => 'Добавить календрь', 'new_item_name' => 'Новое имя календаря', 'menu_name' => 'Календари', ), 'description' => '', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => true, 'query_var' => 'calendars', )); }
Регистрация таксономии «Города»
add_action('init', 'cities_event_taxonomy'); function cities_event_taxonomy() { register_taxonomy('cities', ['events'], [ 'label' => '', 'labels' => [ 'name' => 'Страны', 'singular_name' => 'Страна', 'search_items' => 'Искать страну', 'all_items' => 'Все страны', 'view_item ' => 'Смотреть страну', 'parent_item' => 'Родительская страна', 'parent_item_colon' => 'Родительская страна:', 'edit_item' => 'Редактировать страну', 'update_item' => 'Обновить страну', 'add_new_item' => 'Добавить страну', 'new_item_name' => 'Новое имя страны', 'menu_name' => 'Страны', ], 'description' => '', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => true, 'query_var' => 'cities', ]); }
- Ответ изменён 4 года, 9 месяцев назад пользователем Александр Юрченко.
Просмотр 2 ответов — с 1 по 2 (всего 2)