WP PLUGIN 

・バグ修正:カスタムフィールドのselected属性の追加漏れ修正
This commit is contained in:
2021-06-26 03:09:28 +09:00
parent f6d64404a7
commit ff50cbdff8
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -7,12 +7,16 @@ if ( ! trait_exists( 'CUSTOMFIELD_SELECT' ) ) {
trait CUSTOMFIELD_SELECT {
public static function set_all_customfield_select( $name_meta_key ) {
public static function set_all_customfield_select( $name_meta_key, $meta_key ) {
$selects = self::get_all_custom_fields();
echo '<select class="custom_field_key_select" name="' . esc_attr( $name_meta_key ) . '" required>';
foreach ( $selects as $select ) {
echo '<option value="' . esc_attr( $select->meta_key ) . '">' . esc_html( $select->meta_key ) . '</option>';
if ( $select->meta_key == $meta_key ) {
$selected = ' selected';
} else {
$selected = '';
}
echo '<option value="' . esc_attr( $select->meta_key ) . '"' . esc_attr( $selected ) . '>' . esc_html( $select->meta_key ) . '</option>';
}
echo '</select>';
}