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 ) {
- $post_type = $post_author = $post_date = '';
- $post_id = isset( $_GET['post'] ) ? (int) $_GET['post'] : null;
- if ( $post_id ) {
- $post = get_post( $post_id );
- $post_type = $post->post_type;
- $post_author = $post->post_author;
- $post_date = date( 'Y-m-d', strtotime( $post->post_date ) );
- }
- $prefix = '';
- $meta_boxes[] = array (
- 'title' => esc_html__( 'Filtración', 'text-domain' ),
- 'id' => 'filtracion',
- 'post_types' => array(
- 0 => 'articulo',
- 1 => 'noticia',
- 2 => 'para-empresa',
- ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array (
- 'id' => $prefix . 'text_63oz10nwock',
- 'type' => 'text',
- 'name' => esc_html__( 'Post type', 'text-domain' ),
- 'desc' => esc_html__( 'Current post type.', 'text-domain' ),
- 'required' => 1,
- 'std' => $post_type,
- ),
- array (
- 'id' => $prefix . 'author_hva4qxl9l8',
- 'type' => 'user',
- 'name' => esc_html__( 'Post author', 'text-domain' ),
- 'desc' => esc_html__( 'Current post author.', 'text-domain' ),
- 'field_type' => 'select_advanced',
- 'required' => 1,
- 'multiple' => true,
- 'std' => $post_author,
- ),
- array (
- 'id' => $prefix . 'date_mgw46wuomoh',
- 'type' => 'date',
- 'name' => esc_html__( 'Post Date', 'text-domain' ),
- 'desc' => esc_html__( 'Current post date.', 'text-domain' ),
- 'required' => 1,
- 'std' => $post_date,
- ),
- ),
- );
- return $meta_boxes;
- }
Add Comment
Please, Sign In to add comment