Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Patch to fix checkbox display in Custom Metadata Manager WordPress Plugin
Index: custom_metadata.php
===================================================================
--- custom_metadata.php (revision 499358)
+++ custom_metadata.php (working copy)
@@ -871,12 +871,22 @@
else $field_id = $field_slug;
$readonly_str = ($field->readonly) ? 'readonly="readonly" ' : '';
+
if (get_post_type()) $numb = $post->ID; else $numb = 1; ?>
<script>var numb = '<?php echo $numb ?>'; </script>
- <label for="<?php echo $field_slug; ?>"><?php echo $field->label; ?></label>
- <?php
+ <?php
+ // Set up the <label> tag for this field.
+ $label_str = "<label for='$field_slug'>{$field->label}</label>";
+
+ // Define an array of field types that need the <label> AFTER the <input>
+ $label_after_field_types = array('checkbox');
+
+ // Show the label now if the current field_type is not on the list
+ if ( !in_array( $field->field_type, $label_after_field_types ) )
+ echo $label_str;
+
// make sure $value is an array
if (!$value) $value = ''; // if empty, give it an empty string instead
$value = (array)$value;
@@ -968,14 +978,17 @@
<?php break; ?>
<?php endswitch; ?>
-
<?php if ($count > 1) : ?>
<a href="#" class="del-multiple hide-if-no-js" style="color:red;">Delete</a>
<?php endif; $count++ ?>
</div>
-
- <?php endforeach; ?>
+ <?php
+ // Now show the <label> for any field_type that needs it to come after
+ if ( in_array( $field->field_type, $label_after_field_types ) )
+ echo $label_str;
+
+ endforeach; ?>
<?php if (isset($field->multiple) && $field->multiple) : ?>
<p><a href="#" class="add-multiple hide-if-no-js" id="add-<?php echo $field_slug ?>">+ Add New</a></p>
<?php endif;?>
Index: css/custom-metadata-manager.css
===================================================================
--- css/custom-metadata-manager.css (revision 499358)
+++ css/custom-metadata-manager.css (working copy)
@@ -13,7 +13,9 @@
.custom-metadata-field > div > label > input[type=radio] {margin-right: 5px;}
/* checkbox fields */
-.custom-metadata-field.checkbox {background: transparent}
+.custom-metadata-field.checkbox {background: transparent;}
+.custom-metadata-field.checkbox div, .custom-metadata-field.checkbox label {display: inline-block;}
+.custom-metadata-field.checkbox input {margin: 0 1px 0 0;}
/* upload fields */
.custom-metadata-field input.upload_field {width: 60%;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.