Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
  2. function your_prefix_register_meta_boxes( $meta_boxes ) {
  3. $meta_boxes[] = array (
  4. 'title' => 'Car Rental',
  5. 'id' => 'car-rental',
  6. 'post_types' => array(
  7. 0 => 'car-rental',
  8. ),
  9. 'context' => 'normal',
  10. 'priority' => 'high',
  11. 'fields' => array(
  12. array (
  13. 'id' => 'price',
  14. 'type' => 'number',
  15. 'name' => 'Rental price',
  16. 'required' => 1,
  17. 'prepend' => '$',
  18. ),
  19. array (
  20. 'id' => 'car_year',
  21. 'type' => 'number',
  22. 'name' => 'Car Year',
  23. 'required' => 1,
  24. ),
  25. array (
  26. 'id' => 'max_passengers',
  27. 'type' => 'number',
  28. 'name' => 'Max passengers',
  29. 'required' => 1,
  30. ),
  31. array (
  32. 'id' => 'fuel',
  33. 'name' => 'Fuel',
  34. 'type' => 'select',
  35. 'placeholder' => 'Select an Item',
  36. 'options' => array(
  37. 'Gasoline' => 'Gasoline',
  38. 'Petrol' => 'Petrol',
  39. 'Electricity' => 'Electricity',
  40. ),
  41. 'required' => 1,
  42. ),
  43. array (
  44. 'id' => 'door',
  45. 'name' => 'Door',
  46. 'type' => 'select',
  47. 'placeholder' => 'Select an Item',
  48. 'options' => array(
  49. 2 => '2',
  50. 4 => '4',
  51. 5 => '5',
  52. ),
  53. 'required' => 1,
  54. ),
  55. array (
  56. 'id' => 'gearbox',
  57. 'name' => 'Gearbox',
  58. 'type' => 'select',
  59. 'placeholder' => 'Select an Item',
  60. 'options' => array(
  61. 'Tiptronic' => 'Tiptronic',
  62. 'Manuatic' => 'Manuatic',
  63. ),
  64. 'required' => 1,
  65. ),
  66. array (
  67. 'id' => 'fuel_usage',
  68. 'type' => 'text',
  69. 'name' => 'Fuel Usage',
  70. 'desc' => 'Ex: 101/100km',
  71. ),
  72. array (
  73. 'id' => 'engine_capacity',
  74. 'type' => 'text',
  75. 'name' => 'Engine capacity',
  76. 'desc' => 'Ex: 2500 cc',
  77. ),
  78. array (
  79. 'id' => 'max_luggage',
  80. 'type' => 'text',
  81. 'name' => 'Max luggage',
  82. ),
  83. array (
  84. 'id' => 'mileage',
  85. 'type' => 'text',
  86. 'name' => 'Mileage',
  87. 'desc' => 'Ex: 500km or Unlimited',
  88. ),
  89. ),
  90. );
  91. return $meta_boxes;
  92. }
  93.  
  94. add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes_2' );
  95. function your_prefix_register_meta_boxes_2( $meta_boxes ) {
  96. $meta_boxes[] = array (
  97. 'title' => 'Car rental - Side',
  98. 'id' => 'car-rental-side',
  99. 'post_types' => array(
  100. 0 => 'car-rental',
  101. ),
  102. 'context' => 'side',
  103. 'priority' => 'low',
  104. 'fields' => array(
  105. array (
  106. 'id' => 'car_gallery',
  107. 'type' => 'image_advanced',
  108. 'name' => 'Car gallery',
  109. 'force_delete' => 1,
  110. 'max_file_uploads' => 7,
  111. 'image_size' => 'post-thumbnail',
  112. 'max_status' => true,
  113. ),
  114. ),
  115. );
  116. return $meta_boxes;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement