Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
- function your_prefix_register_meta_boxes( $meta_boxes ) {
- $meta_boxes[] = array (
- 'title' => 'Car Rental',
- 'id' => 'car-rental',
- 'post_types' => array(
- 0 => 'car-rental',
- ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array (
- 'id' => 'price',
- 'type' => 'number',
- 'name' => 'Rental price',
- 'required' => 1,
- 'prepend' => '$',
- ),
- array (
- 'id' => 'car_year',
- 'type' => 'number',
- 'name' => 'Car Year',
- 'required' => 1,
- ),
- array (
- 'id' => 'max_passengers',
- 'type' => 'number',
- 'name' => 'Max passengers',
- 'required' => 1,
- ),
- array (
- 'id' => 'fuel',
- 'name' => 'Fuel',
- 'type' => 'select',
- 'placeholder' => 'Select an Item',
- 'options' => array(
- 'Gasoline' => 'Gasoline',
- 'Petrol' => 'Petrol',
- 'Electricity' => 'Electricity',
- ),
- 'required' => 1,
- ),
- array (
- 'id' => 'door',
- 'name' => 'Door',
- 'type' => 'select',
- 'placeholder' => 'Select an Item',
- 'options' => array(
- 2 => '2',
- 4 => '4',
- 5 => '5',
- ),
- 'required' => 1,
- ),
- array (
- 'id' => 'gearbox',
- 'name' => 'Gearbox',
- 'type' => 'select',
- 'placeholder' => 'Select an Item',
- 'options' => array(
- 'Tiptronic' => 'Tiptronic',
- 'Manuatic' => 'Manuatic',
- ),
- 'required' => 1,
- ),
- array (
- 'id' => 'fuel_usage',
- 'type' => 'text',
- 'name' => 'Fuel Usage',
- 'desc' => 'Ex: 101/100km',
- ),
- array (
- 'id' => 'engine_capacity',
- 'type' => 'text',
- 'name' => 'Engine capacity',
- 'desc' => 'Ex: 2500 cc',
- ),
- array (
- 'id' => 'max_luggage',
- 'type' => 'text',
- 'name' => 'Max luggage',
- ),
- array (
- 'id' => 'mileage',
- 'type' => 'text',
- 'name' => 'Mileage',
- 'desc' => 'Ex: 500km or Unlimited',
- ),
- ),
- );
- return $meta_boxes;
- }
- add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes_2' );
- function your_prefix_register_meta_boxes_2( $meta_boxes ) {
- $meta_boxes[] = array (
- 'title' => 'Car rental - Side',
- 'id' => 'car-rental-side',
- 'post_types' => array(
- 0 => 'car-rental',
- ),
- 'context' => 'side',
- 'priority' => 'low',
- 'fields' => array(
- array (
- 'id' => 'car_gallery',
- 'type' => 'image_advanced',
- 'name' => 'Car gallery',
- 'force_delete' => 1,
- 'max_file_uploads' => 7,
- 'image_size' => 'post-thumbnail',
- 'max_status' => true,
- ),
- ),
- );
- return $meta_boxes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement