Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
- function your_prefix_register_meta_boxes( $meta_boxes ) {
- $prefix = '';
- $meta_boxes[] = array (
- 'title' => esc_html__( 'Untitled Field Group', 'text-domain' ),
- 'id' => 'untitled-field-group',
- 'post_types' => array(
- 0 => 'post',
- ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array (
- 'id' => $prefix . 'select_post_type',
- 'name' => esc_html__( 'Post type', 'text-domain' ),
- 'type' => 'select',
- 'placeholder' => esc_html__( 'Select an Item', 'text-domain' ),
- 'options' => array(
- 'book' => esc_html__( 'book', 'text-domain' ),
- 'author' => esc_html__( 'author', 'text-domain' ),
- 'post' => esc_html__( 'post', 'text-domain' ),
- 'page' => esc_html__( 'page', 'text-domain' ),
- ),
- ),
- array (
- 'id' => $prefix . 'book',
- 'type' => 'post',
- 'name' => esc_html__( 'Book', 'text-domain' ),
- 'post_type' => array(
- 0 => 'book',
- ),
- 'field_type' => 'select_advanced',
- 'visible' => array(
- 'when' => array(
- array (
- 0 => 'select_post_type',
- 1 => '=',
- 2 => 'book',
- ),
- ),
- 'relation' => 'and',
- ),
- ),
- array (
- 'id' => $prefix . 'post',
- 'type' => 'post',
- 'name' => esc_html__( 'Post', 'text-domain' ),
- 'post_type' => array(
- 0 => 'post',
- ),
- 'field_type' => 'select_advanced',
- 'visible' => array(
- 'when' => array(
- array (
- 0 => 'select_post_type',
- 1 => '=',
- 2 => 'post',
- ),
- ),
- 'relation' => 'and',
- ),
- ),
- ),
- );
- return $meta_boxes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement