Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Вариант 1
- $realty_type = get_field_object( 'sas_realty_type' );
- if ( $realty_type ) { ?>
- <div class="filter__item">
- <select name="<?php echo $realty_type['name']; ?>">
- <option selected="selected" disabled>Тип недвижимости</option>
- <?php
- foreach ( $realty_type['choices'] as $key => $value ):
- ?>
- <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
- <?php
- endforeach;
- ?>
- </select>
- </div>
- <?php
- }
- // Вариант 2
- $realty_type = get_field_object( 'sas_realty_type' );
- if ( $realty_type ) {
- $options = '<option selected="selected" disabled>Тип недвижимости</option>';
- foreach ( $realty_type['choices'] as $key => $value ) {
- $options .= sprintf( '<option value="%s">%s</option>', $key, $value );
- }
- $select = sprintf( '<select name="%s">%s</select>', $realty_type['name'], $options );
- printf( '<div class="filter__item">%s</div>', $select );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement