WP PLUGIN
・バグ修正:カスタムフィールドのselected属性の追加漏れ修正
This commit is contained in:
@@ -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>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user