Advertisement
Beee

kncv post types

Mar 21st, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.80 KB | None | 0 0
  1. <?php
  2. /* REGISTER POST TYPES */
  3.  
  4. /*
  5. the post-types which are defined in this file are:
  6. (these can be active or inactive)
  7. - project
  8. - land
  9. - event
  10. - persoon
  11. - kennisbank
  12. - vacatures
  13. */
  14.  
  15. function register_kncv_post_types() {
  16.     $cpt_project = array(
  17.         'labels'                            => array(
  18.             'name'                              => 'Projecten',
  19.             'singular_name'                     => 'Project',
  20.             'menu_name'                         => 'Projecten',
  21.             'add_new'                           => 'Voeg project toe',
  22.             'add_new_item'                      => 'Voeg nieuw project toe',
  23.             'edit_item'                         => 'Edit project',
  24.             'new_item'                          => 'Nieuw project',
  25.             'all_items'                         => 'Alle projecten',
  26.             'view_item'                         => 'Bekijk project',
  27.             'search_items'                      => 'Zoek projecten',
  28.             'not_found'                         => 'Geen project(en)',
  29.             'not_found_in_trash'                => 'Geen project(en) in trash'
  30.         ),
  31.         'public'                                => true,
  32.         'exclude_from_search'                   => false,
  33.         'public_queryable'                      => true,
  34.         'show_ui'                               => true,
  35.         'show_in_menu'                          => true,
  36.         'show_in_admin_bar'                     => true,
  37.         'capability_type'                       => 'project',
  38.         'query_var'                             => true,
  39.         // 'rewrite'                               => array( 'slug' => 'project', 'feeds' => false ),
  40.         'has_archive'                           => true,
  41.         'menu_position'                         => 30,
  42.         'menu_icon'                             => 'dashicons-portfolio',
  43.         'supports'                              => array('title', 'editor', 'thumbnail')
  44.     );
  45.     register_post_type( 'project', $cpt_project );
  46.  
  47.     $cpt_country = array(
  48.         'labels'                            => array(
  49.             'name'                              => 'Landen',
  50.             'singular_name'                     => 'Land',
  51.             'menu_name'                         => 'Landen',
  52.             'add_new'                           => 'Voeg land toe',
  53.             'add_new_item'                      => 'Voeg nieuw land toe',
  54.             'edit_item'                         => 'Edit land',
  55.             'new_item'                          => 'Nieuw land',
  56.             'all_items'                         => 'Alle landen',
  57.             'view_item'                         => 'Bekijk land',
  58.             'search_items'                      => 'Zoek landen',
  59.             'not_found'                         => 'Geen landen',
  60.             'not_found_in_trash'                => 'Geen landen in trash'
  61.         ),
  62.         'public'                                => true,
  63.         'exclude_from_search'                   => false,
  64.         'public_queryable'                      => true,
  65.         'show_ui'                               => true,
  66.         'show_in_menu'                          => true,
  67.         'show_in_admin_bar'                     => true,
  68.         'capability_type'                       => 'gebied',
  69.         'query_var'                             => true,
  70.         'rewrite'                               => array( 'slug' => 'land', 'feeds' => false ),
  71.         'has_archive'                           => true,
  72.         'menu_position'                         => 30,
  73.         'menu_icon'                             => 'dashicons-admin-site',
  74.         'supports'                              => array('title', 'editor', 'thumbnail')
  75.     );
  76.     register_post_type( 'land', $cpt_country );
  77.  
  78.     $cpt_event = array(
  79.         'labels'                            => array(
  80.             'name'                              => 'Event',
  81.             'singular_name'                     => 'Events',
  82.             'menu_name'                         => 'Events',
  83.             'add_new'                           => 'Voeg event toe',
  84.             'add_new_item'                      => 'Voeg nieuw event toe',
  85.             'edit_item'                         => 'Edit event',
  86.             'new_item'                          => 'Nieuw event',
  87.             'all_items'                         => 'Alle events',
  88.             'view_item'                         => 'Bekijk event',
  89.             'search_items'                      => 'Zoek events',
  90.             'not_found'                         => 'Geen events',
  91.             'not_found_in_trash'                => 'Geen events in trash'
  92.         ),
  93.         'public'                                => true,
  94.         'exclude_from_search'                   => false,
  95.         'public_queryable'                      => true,
  96.         'show_ui'                               => true,
  97.         'show_in_menu'                          => true,
  98.         'show_in_admin_bar'                     => true,
  99.         'capability_type'                       => 'event',
  100.         'query_var'                             => true,
  101.         // 'rewrite'                               => array( 'slug' => 'event', 'feeds' => false ),
  102.         'has_archive'                           => true,
  103.         'menu_position'                         => 30,
  104.         'menu_icon'                             => 'dashicons-megaphone',
  105.         'supports'                              => array('title', 'editor', 'thumbnail')
  106.     );
  107.     register_post_type( 'event', $cpt_event );
  108.  
  109.     $cpt_people = array(
  110.         'labels'                            => array(
  111.             'name'                              => 'People',
  112.             'singular_name'                     => 'Persoon', 'kncv',
  113.             'menu_name'                         => 'People',
  114.             'add_new'                           => 'Voeg een persoon toe',
  115.             'add_new_item'                      => 'Voeg nieuw persoon toe',
  116.             'edit_item'                         => 'Edit persoon',
  117.             'new_item'                          => 'Nieuw persoon',
  118.             'all_items'                         => 'Alle personen',
  119.             'view_item'                         => 'Bekijk persoon',
  120.             'search_items'                      => 'Zoek personen',
  121.             'not_found'                         => 'Geen personen',
  122.             'not_found_in_trash'                => 'Geen personen in trash'
  123.         ),
  124.         'public'                                => true,
  125.         'exclude_from_search'                   => false,
  126.         'public_queryable'                      => true,
  127.         'show_ui'                               => true,
  128.         'show_in_menu'                          => true,
  129.         'show_in_admin_bar'                     => true,
  130.         'capability_type'                       => 'person',
  131.         'query_var'                             => true,
  132.         'rewrite'                               => array( 'slug' => 'person', 'feeds' => false ),
  133.         'has_archive'                           => true,
  134.         'menu_position'                         => 30,
  135.         'menu_icon'                             => 'dashicons-universal-access-alt',
  136.         'supports'                              => array('title', 'editor', 'thumbnail')
  137.     );
  138.     register_post_type( 'people', $cpt_people );
  139.  
  140.     $cpt_kennisbank = array(
  141.         'labels'                            => array(
  142.             'name'                              => 'Kennisbank',
  143.             'singular_name'                     => 'Kennisbank',
  144.             'menu_name'                         => 'Kennisbank',
  145.             'add_new'                           => 'Voeg topic toe',
  146.             'add_new_item'                      => 'Voeg nieuw topic toe',
  147.             'edit_item'                         => 'Edit topic',
  148.             'new_item'                          => 'Nieuw topic',
  149.             'all_items'                         => 'Alle topics',
  150.             'view_item'                         => 'Bekijk topic',
  151.             'search_items'                      => 'Zoek topics',
  152.             'not_found'                         => 'Geen topics',
  153.             'not_found_in_trash'                => 'Geen topics in trash'
  154.         ),
  155.         'public'                                => true,
  156.         'exclude_from_search'                   => false,
  157.         'public_queryable'                      => true,
  158.         'show_ui'                               => true,
  159.         'show_in_menu'                          => true,
  160.         'show_in_admin_bar'                     => true,
  161.         'capability_type'                       => 'kb',
  162.         'capabilities' => array(
  163.             'edit_post'          => 'edit_kb',
  164.             'read_post'          => 'read_kb',
  165.             'delete_post'        => 'delete_kb',
  166.             'delete_posts'       => 'delete_kbs',
  167.             'edit_posts'         => 'edit_kbs',
  168.             'edit_others_posts'  => 'edit_others_kbs',
  169.             'publish_posts'      => 'publish_kbs',
  170.             'read_private_posts' => 'read_private_kbs',
  171.             'create_posts'       => 'edit_kbs',
  172.         ),
  173.         'query_var'                             => true,
  174.         // 'rewrite'                               => array( 'slug' => 'kb', 'feeds' => false ),
  175.         'has_archive'                           => true,
  176.         'menu_position'                         => 30,
  177.         'menu_icon'                             => 'dashicons-editor-help',
  178.         'supports'                              => array('title', 'editor', 'thumbnail'),
  179.         // 'taxonomies'                            => array('post_tag')
  180.     );
  181.     register_post_type( 'kb', $cpt_kennisbank );
  182.  
  183.     $cpt_vacancy = array(
  184.         'labels'                            => array(
  185.             'name'                              => 'Vacancies',
  186.             'singular_name'                     => 'Vacancy',
  187.             'menu_name'                         => 'Vacatures',
  188.             'add_new'                           => 'Voeg vacature toe',
  189.             'add_new_item'                      => 'Voeg nieuwe vacature toe',
  190.             'edit_item'                         => 'Edit vacature',
  191.             'new_item'                          => 'Nieuwe vacature',
  192.             'all_items'                         => 'Alle vacatures',
  193.             'view_item'                         => 'Bekijk vacature',
  194.             'search_items'                      => 'Zoek vacatures',
  195.             'not_found'                         => 'Geen vacatures',
  196.             'not_found_in_trash'                => 'Geen vacatures in trash'
  197.         ),
  198.         'public'                                => true,
  199.         'exclude_from_search'                   => false,
  200.         'public_queryable'                      => true,
  201.         'show_ui'                               => true,
  202.         'show_in_menu'                          => true,
  203.         'show_in_admin_bar'                     => true,
  204.         'capability_type'                       => 'vacature',
  205.         'query_var'                             => true,
  206.         // 'rewrite'                               => array( 'slug' => 'vacancy', 'feeds' => false ),
  207.         'has_archive'                           => true,
  208.         'menu_position'                         => 30,
  209.         'hierarchical'                          => false,
  210.         'menu_icon'                             => 'dashicons-clipboard',
  211.         'supports'                              => array('title', 'editor', 'thumbnail')
  212.     );
  213.     register_post_type( 'vacancy', $cpt_vacancy );
  214.  
  215.     $cpt_partners = array(
  216.         'labels'                            => array(
  217.             'name'                              => 'Partners',
  218.             'singular_name'                     => 'Partner',
  219.             'menu_name'                         => 'Partners',
  220.             'add_new'                           => 'Voeg partners toe',
  221.             'add_new_item'                      => 'Voeg nieuwe partners toe',
  222.             'edit_item'                         => 'Edit partners',
  223.             'new_item'                          => 'Nieuwe partners',
  224.             'all_items'                         => 'Alle partners',
  225.             'view_item'                         => 'Bekijk partners',
  226.             'search_items'                      => 'Zoek partners',
  227.             'not_found'                         => 'Geen partners',
  228.             'not_found_in_trash'                => 'Geen partners in trash'
  229.         ),
  230.         'public'                                => true,
  231.         'exclude_from_search'                   => false,
  232.         'public_queryable'                      => true,
  233.         'show_ui'                               => true,
  234.         'show_in_menu'                          => true,
  235.         'show_in_admin_bar'                     => true,
  236.         'capability_type'                       => 'partner',
  237.         'query_var'                             => true,
  238.         // 'rewrite'                               => array( 'slug' => 'partner', 'feeds' => false ),
  239.         'has_archive'                           => true,
  240.         'menu_position'                         => 30,
  241.         'menu_icon'                             => 'dashicons-admin-site',
  242.         'supports'                              => array('title', 'editor', 'thumbnail')
  243.     );
  244.     register_post_type( 'partner', $cpt_partners );
  245.  
  246. }
  247. add_action( 'init', 'register_kncv_post_types' );
  248.  
  249. function register_kncv_post_tax() {
  250.     // add soort to kb
  251.     $soort_tax = array(
  252.         'labels'                    => array(
  253.             'name'                  => 'Soort document',
  254.             'singular_name'         => 'Soort',
  255.             'menu_name'             => 'Soort document',
  256.             'all_items'             => 'Alle soorten',
  257.             'edit_item'             => 'Edit soort',
  258.             'view_item'             => 'Bekijk soort',
  259.             'update_item'           => 'Update soort',
  260.             'add_new_item'          => 'Nieuwe soort',
  261.             'new_item_name'         => 'Nieuwe soort',
  262.             'search_items'          => 'Zoek soort',
  263.             'popular_items'         => 'Populaire soorten',
  264.             'not_found'             => 'Geen soorten',
  265.             'not_found_in_trash'    => 'Geen soorten in trash'
  266.         ),
  267.         'public'                    => true,
  268.         'show_ui'                   => true,
  269.         'show_in_nav_menus'         => false, // defaults to public
  270.         'show_in_quick_edit'        => true, // defaults to show_ui
  271.         'show_admin_column'         => true, // defaults to false
  272.         'hierarchical'              => true, // defaults to false
  273.         // 'update_count_callback'          => '',
  274.         'query_var'                 => 'soort',
  275.         'rewrite'                   => array( 'slug' => 'soort', 'hierarchical' => true )
  276.     );
  277.     register_taxonomy( 'soort', 'kb', $soort_tax );
  278.  
  279.     // add thema to kb
  280.     $thema_tax = array(
  281.         'labels'                    => array(
  282.             'name'                  => 'Thema\'s',
  283.             'singular_name'         => 'Thema',
  284.             'menu_name'             => 'Thema\'s',
  285.             'all_items'             => 'Alle thema\'s',
  286.             'edit_item'             => 'Edit thema',
  287.             'view_item'             => 'Bekijk thema',
  288.             'update_item'           => 'Update thema',
  289.             'add_new_item'          => 'Nieuwe thema',
  290.             'new_item_name'         => 'Nieuwe thema',
  291.             'search_items'          => 'Zoek thema',
  292.             'popular_items'         => 'Populaire thema\'s',
  293.             'not_found'             => 'Geen thema\'s',
  294.             'not_found_in_trash'    => 'Geen thema\'s in trash'
  295.         ),
  296.         'public'                    => true,
  297.         'show_ui'                   => true,
  298.         'show_in_nav_menus'         => false, // defaults to public
  299.         'show_in_quick_edit'        => false, // defaults to show_ui
  300.         'show_admin_column'         => true, // defaults to false
  301.         // 'hierarchical'              => true, // defaults to false
  302.         // 'update_count_callback'          => '',
  303.         'query_var'                 => 'thema',
  304.         'rewrite'                   => array( 'slug' => 'thema', 'hierarchical' => true )
  305.     );
  306.     register_taxonomy( 'thema', 'kb', $thema_tax );
  307.  
  308.     // add thema to kb
  309.     $country_tax = array(
  310.         'labels'                    => array(
  311.             'name'                  => 'Land',
  312.             'singular_name'         => 'Land',
  313.             'menu_name'             => 'Landen',
  314.             'all_items'             => 'Alle landen',
  315.             'edit_item'             => 'Edit land',
  316.             'view_item'             => 'Bekijk land',
  317.             'update_item'           => 'Update land',
  318.             'add_new_item'          => 'Nieuw land',
  319.             'new_item_name'         => 'Nieuw land',
  320.             'search_items'          => 'Zoek land',
  321.             'popular_items'         => 'Populaire landen',
  322.             'not_found'             => 'Geen landen',
  323.             'not_found_in_trash'    => 'Geen landen in trash'
  324.         ),
  325.         'public'                    => true,
  326.         'show_ui'                   => true,
  327.         'show_in_nav_menus'         => false, // defaults to public
  328.         'show_in_quick_edit'        => false, // defaults to show_ui
  329.         'show_admin_column'         => true, // defaults to false
  330.         // 'hierarchical'              => true, // defaults to false
  331.         // 'update_count_callback'          => '',
  332.         'query_var'                 => 'country',
  333.         'rewrite'                   => array( 'slug' => 'country', 'hierarchical' => true )
  334.     );
  335.     register_taxonomy( 'country', 'vacancy', $country_tax );
  336.  
  337. }
  338. add_action( 'init', 'register_kncv_post_tax' );
  339. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement