Skip to content

Instantly share code, notes, and snippets.

@RiodeJaneiroo
Last active October 9, 2018 15:01
Show Gist options
  • Save RiodeJaneiroo/cabd52ab72bf634b485f10ecc00151f4 to your computer and use it in GitHub Desktop.
Save RiodeJaneiroo/cabd52ab72bf634b485f10ecc00151f4 to your computer and use it in GitHub Desktop.
[Wordpress F.A.Q|Portfolio| CPT] Wordpress – register post type - faq|Portfolio| #wordpress #cpt #no_url #register_post_type #faq #portfolio
add_action('init', 'art_register_port');
function art_register_port(){
register_post_type('portfolio', array(
'labels' => array(
'name' => 'Portfolio', // Основное название типа записи
'singular_name' => 'Portfolio', // отдельное название записи типа Book
'add_new' => 'Add',
'add_new_item' => 'Add new',
'edit_item' => 'Edit',
'new_item' => 'New',
'view_item' => 'View',
'search_items' => 'Find ',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not fount in trash',
'parent_item_colon' => '',
'menu_name' => 'Portfolio'
),
'menu_icon' => 'dashicons-lightbulb',
'public' => false, // it's not public, it shouldn't have it's own permalink, and so on
'publicly_queryable' => true, // you should be able to query it
'show_ui' => true, // you should be able to edit it in wp-admin
'exclude_from_search' => true, // you should exclude it from search results
'show_in_nav_menus' => false, // you shouldn't be able to add it to menus
'has_archive' => false, // it shouldn't have archive page
'rewrite' => false, // it shouldn't have rewrite rules
'supports' => array('title','editor')
) );
}
add_action('init', 'art_register_faq');
function art_register_faq(){
register_post_type('theme_faq', array(
'labels' => array(
'name' => 'FAQ', // Основное название типа записи
'singular_name' => 'FAQ', // отдельное название записи типа Book
'add_new' => 'Добавить',
'add_new_item' => 'Добавить новый ответ на вопрос',
'edit_item' => 'Редактировать ',
'new_item' => 'Новая ',
'view_item' => 'Посмотреть faq',
'search_items' => 'Найти ',
'not_found' => 'Не найдено',
'not_found_in_trash' => 'В корзине не найдено',
'parent_item_colon' => '',
'menu_name' => 'FAQ'
),
'menu_icon' => 'dashicons-sos',
'public' => false, // it's not public, it shouldn't have it's own permalink, and so on
'publicly_queryable' => true, // you should be able to query it
'show_ui' => true, // you should be able to edit it in wp-admin
'exclude_from_search' => true, // you should exclude it from search results
'show_in_nav_menus' => false, // you shouldn't be able to add it to menus
'has_archive' => false, // it shouldn't have archive page
'rewrite' => false, // it shouldn't have rewrite rules
'supports' => array('title','editor')
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment