lundi 13 juillet 2020

I need help to convert checkbox to dropdown list in php

<div class="<?php echo esc_attr( rtrim( $css_classes_string ) ); ?>">
    <ul>
        <?php
        if ( $prices ) :
            $checked_key = isset( $_GET['price_option'] ) ? absint( $_GET['price_option'] ) : edd_get_default_variable_price( $download_id );
            foreach ( $prices as $key => $price ) :
                echo '<li id="edd_price_option_' . $download_id . '_' . sanitize_key( $price['name'] ) . $form_id . '"' . $schema . '>';
                    echo '<label for="' . esc_attr( 'edd_price_option_' . $download_id . '_' . $key . $form_id ) . '">';
                        echo '<input type="' . $type . '" ' . checked( apply_filters( 'edd_price_option_checked', $checked_key, $download_id, $key ), $key, false ) . ' name="edd_options[price_id][]" id="' . esc_attr( 'edd_price_option_' . $download_id . '_' . $key . $form_id ) . '" class="' . esc_attr( 'edd_price_option_' . $download_id ) . '" value="' . esc_attr( $key ) . '" data-price="' . edd_get_price_option_amount( $download_id, $key ) .'"/>&nbsp;';

                        echo '<span class="check-mark"></span>';

                        $item_prop = edd_add_schema_microdata() ? ' itemprop="description"' : '';

                        // Construct the default price output.
                        $price_output = '<span class="edd_price_option_name"' . $item_prop . '>' . esc_html( $price['name'] ) . '</span><span class="edd_price_option_sep">&nbsp;&ndash;&nbsp;</span><span class="edd_price_option_price">' . edd_currency_filter( edd_format_amount( $price['amount'] ) ) . '</span>';

                        // Filter the default price output
                        $price_output = apply_filters( 'edd_price_option_output', $price_output, $download_id, $key, $price, $form_id, $item_prop );

                        // Output the filtered price output
                        echo $price_output;

                        if( edd_add_schema_microdata() ) {
                            echo '<meta itemprop="price" content="' . esc_attr( $price['amount'] ) .'" />';
                            echo '<meta itemprop="priceCurrency" content="' . esc_attr( edd_get_currency() ) .'" />';
                        }

                    echo '</label>';
                    do_action( 'edd_after_price_option', $key, $price, $download_id );
                echo '</li>';
            endforeach;
        endif;
        do_action( 'edd_after_price_options_list', $download_id, $prices, $type );
        ?>
    </ul>
</div><!--end .edd_price_options-->`



Aucun commentaire:

Enregistrer un commentaire