WordPress-Plugin-Template icon indicating copy to clipboard operation
WordPress-Plugin-Template copied to clipboard

Bug fix plus code enhancements, custom field with type = "color"

Open a-fawzy opened this issue 9 years ago • 0 comments

Scenario: Add custom field with type = "color" Expected: The field is rendered on the backend and whenever new color is selected the input box value will be updated. Current Behavior: The color is selected but the input value remains blank.

File: includes/lib/class-{custom-post}-admin-api.php Function: display_field() Section: Get saved data

Fixes plus code enhancements - should replace current lines of 35 to 66: // Get saved data $option_name .= $field['id']; ($post) ? $option = get_post_meta( $post->ID, $field['id'], true ) : $option = get_option( $option_name ); if ( isset( $option ) && $option != '' ) { $data = $option; } else if(isset($field['default'])){ $data = $field['default']; } else { $data = ''; }

a-fawzy avatar Sep 03 '15 15:09 a-fawzy