Meta Box - Version 5.4.1

Version Description

  • 2021-06-01 =
  • Improve style for prepend, append text
  • Improve style for select2 on mobiles
  • Make select_tree extend select_advanced and respect select_advanced options
Download this release

Release Info

Developer rilwis
Plugin Icon 128x128 Meta Box
Version 5.4.1
Comparing to
See all releases

Code changes from version 5.4.0 to 5.4.1

css/input.css CHANGED
@@ -2,34 +2,27 @@
2
  display: flex;
3
  align-items: stretch;
4
  }
5
- .rwmb-input-group-append,
6
- .rwmb-input-group-prepend {
7
  display: flex;
8
  align-items: center;
9
  padding: 0 8px;
10
- background: #ddd;
11
- }
12
- .rwmb-input-group input {
13
- margin: 0;
14
- }
15
-
16
- /* Dark version for WordPress >= 5.3 */
17
- .rwmb-input-dark .rwmb-input-group-append,
18
- .rwmb-input-dark .rwmb-input-group-prepend {
19
  border: 1px solid #7e8993;
 
20
  }
21
- .rwmb-input-dark .rwmb-input-group-append {
22
- border-radius: 0 4px 4px 0;
 
 
23
  }
24
- .rwmb-input-dark .rwmb-input-group-prepend {
25
- border-radius: 4px 0 0 4px;
 
 
26
  }
27
- .rwmb-input-dark input {
28
- border-right-width: 0;
29
- border-radius: 4px 0 0 4px;
30
  }
31
- .rwmb-input-dark .rwmb-input-group-prepend + input {
32
- border-left: none;
33
- border-right-width: 1px;
34
- border-radius: 0 4px 4px 0;
35
  }
2
  display: flex;
3
  align-items: stretch;
4
  }
5
+ .rwmb-input-group-text {
 
6
  display: flex;
7
  align-items: center;
8
  padding: 0 8px;
9
+ background: #f0f0f0;
 
 
 
 
 
 
 
 
10
  border: 1px solid #7e8993;
11
+ border-radius: 4px;;
12
  }
13
+ .rwmb-input-group-text:first-child,
14
+ .rwmb-input-group input:not(:last-child) {
15
+ border-top-right-radius: 0;
16
+ border-bottom-right-radius: 0;
17
  }
18
+ .rwmb-input-group-text:last-child,
19
+ .rwmb-input-group input:not(:first-child) {
20
+ border-top-left-radius: 0;
21
+ border-bottom-left-radius: 0;
22
  }
23
+ .rwmb-input-group input {
24
+ margin: 0;
 
25
  }
26
+ .rwmb-input-group :not(:first-child) {
27
+ margin-left: -1px;
 
 
28
  }
css/select-advanced.css CHANGED
@@ -1,18 +1,30 @@
1
  .rwmb-field .select2-container {
2
  height: auto;
3
- min-width: 200px;
4
  max-width: 100%;
5
  }
6
- #wpbody .select2-selection--single,
7
- #wpbody .select2-selection--multiple,
8
  .select2-dropdown {
9
- border-color: #ddd;
10
- }
11
- #wpbody .rwmb-select-advanced-dark .select2-selection--single,
12
- #wpbody .rwmb-select-advanced-dark .select2-selection--multiple,
13
- .rwmb-select-advanced-dark .select2-dropdown {
14
  border-color: #7e8993;
15
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  .select2-results__option {
17
  margin-bottom: 0;
18
  }
@@ -21,8 +33,21 @@
21
  }
22
  .select2-search--dropdown .select2-search__field {
23
  padding: 0 4px;
24
- min-height: 28px;
25
  }
 
26
  body > .select2-container {
27
  z-index: 999999;
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
1
  .rwmb-field .select2-container {
2
  height: auto;
3
+ min-width: 160px;
4
  max-width: 100%;
5
  }
6
+ .select2-container .select2-selection--single,
7
+ .select2-container .select2-selection--multiple,
8
  .select2-dropdown {
 
 
 
 
 
9
  border-color: #7e8993;
10
  }
11
+ .select2-container--open .select2-dropdown--below {
12
+ border-top: 1px solid #7e8993;
13
+ top: -1px;
14
+ }
15
+ .select2-container--open .select2-dropdown--above {
16
+ border-bottom: 1px solid #7e8993;
17
+ bottom: -1px;
18
+ }
19
+ .select2-container .select2-selection--single {
20
+ height: 30px;
21
+ }
22
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
23
+ line-height: 30px;
24
+ }
25
+ .select2-container--default .select2-selection--single .select2-selection__arrow {
26
+ height: 28px;
27
+ }
28
  .select2-results__option {
29
  margin-bottom: 0;
30
  }
33
  }
34
  .select2-search--dropdown .select2-search__field {
35
  padding: 0 4px;
36
+ min-height: 30px;
37
  }
38
+
39
  body > .select2-container {
40
  z-index: 999999;
41
+ }
42
+
43
+ @media (max-width: 782px) {
44
+ .select2-container .select2-selection--single {
45
+ height: 40px;
46
+ }
47
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
48
+ line-height: 40px;
49
+ }
50
+ .select2-container--default .select2-selection--single .select2-selection__arrow {
51
+ height: 38px;
52
+ }
53
  }
css/style.css CHANGED
@@ -29,7 +29,7 @@
29
  }
30
  .rwmb-input input,
31
  .rwmb-input select {
32
- max-width: 99%;
33
  }
34
 
35
  /* 75% if field has label, 100% if no label */
29
  }
30
  .rwmb-input input,
31
  .rwmb-input select {
32
+ max-width: 100%;
33
  }
34
 
35
  /* 75% if field has label, 100% if no label */
inc/fields/input.php CHANGED
@@ -26,24 +26,19 @@ abstract class RWMB_Input_Field extends RWMB_Field {
26
  public static function html( $meta, $field ) {
27
  $output = '';
28
 
29
- $wrapper_class = 'rwmb-input-group';
30
- if ( version_compare( get_bloginfo( 'version' ), '5.3', '>=' ) ) {
31
- $wrapper_class .= ' rwmb-input-dark';
32
- }
33
-
34
  if ( $field['prepend'] || $field['append'] ) {
35
- $output = "<div class='$wrapper_class'>";
36
  }
37
 
38
  if ( $field['prepend'] ) {
39
- $output .= '<span class="rwmb-input-group-prepend">' . esc_html( $field['prepend'] ) . '</span>';
40
  }
41
 
42
  $attributes = self::call( 'get_attributes', $field, $meta );
43
  $output .= sprintf( '<input %s>%s', self::render_attributes( $attributes ), self::datalist( $field ) );
44
 
45
  if ( $field['append'] ) {
46
- $output .= '<span class="rwmb-input-group-append">' . esc_html( $field['append'] ) . '</span>';
47
  }
48
 
49
  if ( $field['prepend'] || $field['append'] ) {
26
  public static function html( $meta, $field ) {
27
  $output = '';
28
 
 
 
 
 
 
29
  if ( $field['prepend'] || $field['append'] ) {
30
+ $output = '<div class="rwmb-input-group">';
31
  }
32
 
33
  if ( $field['prepend'] ) {
34
+ $output .= '<span class="rwmb-input-group-text">' . esc_html( $field['prepend'] ) . '</span>';
35
  }
36
 
37
  $attributes = self::call( 'get_attributes', $field, $meta );
38
  $output .= sprintf( '<input %s>%s', self::render_attributes( $attributes ), self::datalist( $field ) );
39
 
40
  if ( $field['append'] ) {
41
+ $output .= '<span class="rwmb-input-group-text">' . esc_html( $field['append'] ) . '</span>';
42
  }
43
 
44
  if ( $field['prepend'] || $field['append'] ) {
inc/fields/select-advanced.php CHANGED
@@ -53,16 +53,12 @@ class RWMB_Select_Advanced_Field extends RWMB_Select_Field {
53
  $field['js_options'] = wp_parse_args(
54
  $field['js_options'],
55
  array(
56
- 'allowClear' => true,
57
- 'width' => 'none',
58
- 'placeholder' => $field['placeholder'],
59
  )
60
  );
61
 
62
- if ( version_compare( get_bloginfo( 'version' ), '5.3', '>=' ) ) {
63
- $field['class'] .= ' rwmb-select-advanced-dark';
64
- }
65
-
66
  return $field;
67
  }
68
 
53
  $field['js_options'] = wp_parse_args(
54
  $field['js_options'],
55
  array(
56
+ 'allowClear' => true,
57
+ 'dropdownAutoWidth' => true,
58
+ 'placeholder' => $field['placeholder'],
59
  )
60
  );
61
 
 
 
 
 
62
  return $field;
63
  }
64
 
inc/fields/select-tree.php CHANGED
@@ -8,7 +8,7 @@
8
  /**
9
  * Select tree field class.
10
  */
11
- class RWMB_Select_Tree_Field extends RWMB_Select_Field {
12
  /**
13
  * Get field HTML.
14
  *
8
  /**
9
  * Select tree field class.
10
  */
11
+ class RWMB_Select_Tree_Field extends RWMB_Select_Advanced_Field {
12
  /**
13
  * Get field HTML.
14
  *
inc/loader.php CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
- define( 'RWMB_VER', '5.4.0' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
+ define( 'RWMB_VER', '5.4.1' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
js/select-tree.js CHANGED
@@ -47,10 +47,15 @@
47
  }
48
 
49
  function init( e ) {
50
- var $el = $( e.target );
51
 
52
- $el.find( '.rwmb-select-tree > select' ).select2();
53
- $el.find( '.rwmb-select-tree > select' ).each( setInitialRequiredProp );
 
 
 
 
 
54
  }
55
 
56
  rwmb.$document
47
  }
48
 
49
  function init( e ) {
50
+ var $select = $( e.target ).find( '.rwmb-select-tree > select' );
51
 
52
+ $select.each ( setInitialRequiredProp );
53
+ $select.each( function() {
54
+ const $this = $( this ),
55
+ options = $this.data( 'options' );
56
+
57
+ $this.select2( options );
58
+ } );
59
  }
60
 
61
  rwmb.$document
meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
- * Version: 5.4.0
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
@@ -14,17 +14,6 @@
14
  */
15
 
16
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
17
- register_activation_hook( __FILE__, 'rwmb_check_php_version' );
18
-
19
- /**
20
- * Display notice for old PHP version.
21
- */
22
- function rwmb_check_php_version() {
23
- if ( version_compare( phpversion(), '5.6', '<' ) ) {
24
- die( esc_html__( 'Meta Box requires PHP version 5.6+. Please contact your host to upgrade.', 'meta-box' ) );
25
- }
26
- }
27
-
28
  require_once dirname( __FILE__ ) . '/inc/loader.php';
29
  $rwmb_loader = new RWMB_Loader();
30
  $rwmb_loader->init();
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
+ * Version: 5.4.1
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
14
  */
15
 
16
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
 
 
 
 
 
 
 
 
 
 
 
17
  require_once dirname( __FILE__ ) . '/inc/loader.php';
18
  $rwmb_loader = new RWMB_Loader();
19
  $rwmb_loader->init();
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://metabox.io/pricing/
4
  Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta boxes, custom field, post type, taxonomy, meta, admin, advanced, custom, edit, field, file, image, magic fields, post types, more fields, post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Requires PHP: 5.6
7
- Tested up to: 5.7
8
- Stable tag: 5.4.0
9
  License: GPLv2 or later
10
 
11
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
@@ -168,6 +168,11 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
168
 
169
  == Changelog ==
170
 
 
 
 
 
 
171
  = 5.4.0 - 2021-05-08 =
172
  - Shortcode: add `render_shortcodes` attribute (default true) to allow render inner shortcodes.
173
  - File fields: allow to change uploaded file name when uploading to custom folder via `unique_filename_callback` setting
4
  Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta boxes, custom field, post type, taxonomy, meta, admin, advanced, custom, edit, field, file, image, magic fields, post types, more fields, post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Requires PHP: 5.6
7
+ Tested up to: 5.7.2
8
+ Stable tag: 5.4.1
9
  License: GPLv2 or later
10
 
11
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
168
 
169
  == Changelog ==
170
 
171
+ = 5.4.1 - 2021-06-01 =
172
+ - Improve style for prepend, append text
173
+ - Improve style for select2 on mobiles
174
+ - Make select_tree extend select_advanced and respect select_advanced options
175
+
176
  = 5.4.0 - 2021-05-08 =
177
  - Shortcode: add `render_shortcodes` attribute (default true) to allow render inner shortcodes.
178
  - File fields: allow to change uploaded file name when uploading to custom folder via `unique_filename_callback` setting