Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.36 KB | None | 0 0
  1.  
  2. add_action( 'init', 'register_cpt_travel' );
  3.  
  4. function register_cpt_travel() {
  5.  
  6.     $labels = array(
  7.         'name' => _x( 'travels', 'travel' ),
  8.         'singular_name' => _x( 'travel', 'travel' ),
  9.         'add_new' => _x( 'Add New', 'travel' ),
  10.         'add_new_item' => _x( 'Add New travel', 'travel' ),
  11.         'edit_item' => _x( 'Edit travel', 'travel' ),
  12.         'new_item' => _x( 'New travel', 'travel' ),
  13.         'view_item' => _x( 'View travel', 'travel' ),
  14.         'search_items' => _x( 'Search travels', 'travel' ),
  15.         'not_found' => _x( 'No travels found', 'travel' ),
  16.         'not_found_in_trash' => _x( 'No travels found in Trash', 'travel' ),
  17.         'parent_item_colon' => _x( 'Parent travel:', 'travel' ),
  18.         'menu_name' => _x( 'travels', 'travel' ),
  19.     );
  20.  
  21.     $args = array(
  22.         'labels' => $labels,
  23.         'hierarchical' => false,
  24.        
  25.         'supports' => array( 'title', 'editor' ),
  26.         'taxonomies' => array( 'type', 'place', 'level' ),
  27.         'public' => true,
  28.         'show_ui' => true,
  29.         'show_in_menu' => true,
  30.         'menu_position' => 5,
  31.        
  32.         'show_in_nav_menus' => true,
  33.         'publicly_queryable' => true,
  34.         'exclude_from_search' => false,
  35.         'has_archive' => true,
  36.         'query_var' => true,
  37.         'can_export' => true,
  38.         'rewrite' => true,
  39.         'capability_type' => 'post'
  40.     );
  41.  
  42.     register_post_type( 'travel', $args );
  43. }
  44.  
  45. add_action( 'init', 'register_taxonomy_level' );
  46.  
  47. function register_taxonomy_level() {
  48.  
  49.     $labels = array(
  50.         'name' => _x( 'Level', 'levels' ),
  51.         'singular_name' => _x( 'Levels', 'levels' ),
  52.         'search_items' => _x( 'Search Level', 'levels' ),
  53.         'popular_items' => _x( 'Popular Level', 'levels' ),
  54.         'all_items' => _x( 'All Level', 'levels' ),
  55.         'parent_item' => _x( 'Parent Levels', 'levels' ),
  56.         'parent_item_colon' => _x( 'Parent Levels:', 'levels' ),
  57.         'edit_item' => _x( 'Edit Levels', 'levels' ),
  58.         'update_item' => _x( 'Update Levels', 'levels' ),
  59.         'add_new_item' => _x( 'Add New Levels', 'levels' ),
  60.         'new_item_name' => _x( 'New Levels Name', 'levels' ),
  61.         'separate_items_with_commas' => _x( 'Separate level with commas', 'levels' ),
  62.         'add_or_remove_items' => _x( 'Add or remove level', 'levels' ),
  63.         'choose_from_most_used' => _x( 'Choose from the most used level', 'levels' ),
  64.         'menu_name' => _x( 'Level', 'levels' ),
  65.     );
  66.  
  67.     $args = array(
  68.         'labels' => $labels,
  69.         'public' => true,
  70.         'show_in_nav_menus' => true,
  71.         'show_ui' => true,
  72.         'show_tagcloud' => true,
  73.         'hierarchical' => true,
  74.  
  75.         'rewrite' => true,
  76.         'query_var' => true
  77.     );
  78.  
  79.     register_taxonomy( 'level', array('travel'), $args );
  80. }
  81.  
  82. add_action( 'init', 'register_taxonomy_place' );
  83.  
  84. function register_taxonomy_place() {
  85.  
  86.     $places = array(
  87.         'name' => _x( 'places', 'places' ),
  88.         'singular_name' => _x( 'places', 'places' ),
  89.         'search_items' => _x( 'Search place', 'places' ),
  90.         'popular_items' => _x( 'Popular place', 'places' ),
  91.         'all_items' => _x( 'All place', 'places' ),
  92.         'parent_item' => _x( 'Parent places', 'places' ),
  93.         'parent_item_colon' => _x( 'Parent places:', 'places' ),
  94.         'edit_item' => _x( 'Edit places', 'places' ),
  95.         'update_item' => _x( 'Update places', 'places' ),
  96.         'add_new_item' => _x( 'Add New places', 'places' ),
  97.         'new_item_name' => _x( 'New places Name', 'places' ),
  98.         'separate_items_with_commas' => _x( 'Separate place with commas', 'places' ),
  99.         'add_or_remove_items' => _x( 'Add or remove place', 'places' ),
  100.         'choose_from_most_used' => _x( 'Choose from the most used place', 'places' ),
  101.         'menu_name' => _x( 'place', 'places' ),
  102.     );
  103.  
  104.     $args = array(
  105.         'places' => $places,
  106.         'public' => true,
  107.         'show_in_nav_menus' => true,
  108.         'show_ui' => true,
  109.         'show_tagcloud' => true,
  110.         'hierarchical' => true,
  111.  
  112.         'rewrite' => true,
  113.         'query_var' => true
  114.     );
  115.  
  116.     register_taxonomy( 'place', array('travel'), $args );
  117. }
  118.  
  119. add_action( 'init', 'register_taxonomy_type' );
  120.  
  121. function register_taxonomy_type() {
  122.  
  123.     $labels = array(
  124.         'name' => _x( 'type', 'types' ),
  125.         'singular_name' => _x( 'types', 'types' ),
  126.         'search_items' => _x( 'Search type', 'types' ),
  127.         'popular_items' => _x( 'Popular type', 'types' ),
  128.         'all_items' => _x( 'All type', 'types' ),
  129.         'parent_item' => _x( 'Parent types', 'types' ),
  130.         'parent_item_colon' => _x( 'Parent types:', 'types' ),
  131.         'edit_item' => _x( 'Edit types', 'types' ),
  132.         'update_item' => _x( 'Update types', 'types' ),
  133.         'add_new_item' => _x( 'Add New types', 'types' ),
  134.         'new_item_name' => _x( 'New types Name', 'types' ),
  135.         'separate_items_with_commas' => _x( 'Separate type with commas', 'types' ),
  136.         'add_or_remove_items' => _x( 'Add or remove type', 'types' ),
  137.         'choose_from_most_used' => _x( 'Choose from the most used type', 'types' ),
  138.         'menu_name' => _x( 'type', 'types' ),
  139.     );
  140.  
  141.     $args = array(
  142.         'labels' => $labels,
  143.         'public' => true,
  144.         'show_in_nav_menus' => true,
  145.         'show_ui' => true,
  146.         'show_tagcloud' => true,
  147.         'hierarchical' => true,
  148.  
  149.         'rewrite' => true,
  150.         'query_var' => true
  151.     );
  152.  
  153.     register_taxonomy( 'type', array('travel'), $args );
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement