samedi 4 décembre 2021

Could you show me how to convert checkboxes to dropdown fields in WordPress?

Is it possible to convert checkboxes to dropdown options? Here's my code. Is it also possible to include checkboxes within the dropdown for multi-selection?

<ul class="kw-features-list">

    <?php foreach( $job_tags as $feature ): ?>
        <li>
        <label for="kw-feature-<?php echo esc_attr( $feature->slug ) ?>" class="checkbox-inline">
            <?php $checked = ( in_array( $feature->slug, $atts['selected_feature'] ) ) ? ' checked="checked"' : ''; ?>
            <input class="search_feature" name="search_feature[]" <?php echo esc_attr($checked)  ?>        
             id="kw-feature-<?php echo esc_attr( $feature->slug ) ?>" type="checkbox" value="<?php echo esc_attr($feature->slug) ?>">
            <?php echo esc_attr($feature->name) ?>
        </label>
        </li>
    <?php endforeach; ?>

    </ul><!--/ .kw-features-list-->



Aucun commentaire:

Enregistrer un commentaire