Advertisement
stopd

MetaBox Tabs generated with Builder

Aug 22nd, 2020
2,743
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. <?php
  2. add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
  3.  
  4. function your_prefix_register_meta_boxes( $meta_boxes ) {
  5.     $prefix = '';
  6.  
  7.     $meta_boxes[] = [
  8.         'title'      => esc_html__( 'Header image info', 'nr' ),
  9.         'id'         => 'header-image-info',
  10.         'post_types' => ['post', 'page'],
  11.         'context'    => 'normal',
  12.         'priority'   => 'high',
  13.         'fields'     => [
  14.             [
  15.                 'id'   => $prefix . 'bgpos_horiz',
  16.                 'type' => 'number',
  17.                 'name' => esc_html__( 'x postion (%)', 'nr' ),
  18.                 'size' => 3,
  19.                 'tab'  => 'position',
  20.             ],
  21.             [
  22.                 'id'   => $prefix . 'bgpos_vert',
  23.                 'type' => 'number',
  24.                 'name' => esc_html__( 'y position (%)', 'nr' ),
  25.                 'size' => 3,
  26.                 'tab'  => 'position',
  27.             ],
  28.             [
  29.                 'id'   => $prefix . 'img_attr',
  30.                 'type' => 'text',
  31.                 'name' => esc_html__( 'Image attribution', 'nr' ),
  32.                 'size' => 30,
  33.                 'tab'  => 'attribution',
  34.             ],
  35.             [
  36.                 'id'   => $prefix . 'img_src_url',
  37.                 'type' => 'text',
  38.                 'name' => esc_html__( 'Source URL', 'nr' ),
  39.                 'tab'  => 'attribution',
  40.             ],
  41.         ],
  42.     ];
  43.  
  44.     return $meta_boxes;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement