Skip to content

Instantly share code, notes, and snippets.

@levenokk
Created January 30, 2020 18:15
Show Gist options
  • Save levenokk/9eb9db6595ba71c043cf550e6cfe4f3e to your computer and use it in GitHub Desktop.
Save levenokk/9eb9db6595ba71c043cf550e6cfe4f3e to your computer and use it in GitHub Desktop.
Добавления нового поста в wordpress
add_action('init', 'register_post_types');
function register_post_types()
{
register_post_type('portfolio', array(
'labels' => array(
'name' => 'Портфолио', // Основное название типа записи
'singular_name' => 'Портфолио', // отдельное название записи типа Book
'add_new' => 'Добавить пост к записи',
'add_new_item' => 'Добавления поста к записи',
'edit_item' => 'Редактировать пост',
'new_item' => 'Новый пост для портфолио',
'view_item' => 'Посмотреть пост портфолио',
'search_items' => 'Найти пост портфолио',
'not_found' => 'Посты не найдены',
'not_found_in_trash' => 'В корзине постов не найдено',
'parent_item_colon' => '',
'menu_name' => 'Портфолио'
),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 5,
'supports' => array('title', 'editor', 'thumbnail', 'tags', 'excerpt'),
'menu_icon' => 'dashicons-format-gallery'
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment