Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // d.) settings
- add_settings_field(
- 'woonumday_wndtaxbase_field',
- esc_attr__('Tax Options', 'woonumday'),
- 'woonumday_wndtaxbase_field_cb',
- 'woonumday_options',
- 'woonumday_options_section',
- array(
- 'type' => 'select',
- 'option_group' => 'woonumday_options',
- 'name' => 'woonumday_wndtaxbase_field',
- 'value' => esc_attr(
- get_option( 'woonumday_options' )['woonumday_wndtaxbase_field'] ),
- 'options' => array(
- "standard" => "Standard",
- "reduced" => "Reduced",
- "zero" => "Zero" ),
- 'description' => esc_html__( 'This adjust the Additional Fee tax rate only
- - not the product tax rate.', 'woonumday' ),
- 'tip' => esc_attr__( 'Choices are: standard | reduced | zero
- See Woocommerce Settings to set taxes', 'woonumday' )
- )
- );
- // Callback
- /**
- * d.) 'select' field
- * @since 1.0.0
- */
- function woonumday_wndtaxbase_field_cb($args)
- {
- print('<label for="woonumday_wndtaxbase_field">');
- if( ! empty ( $args['options'] && is_array( $args['options'] ) ) )
- {
- $options_markup = '';
- $value = $args['value'];
- foreach( $args['options'] as $key => $label )
- {
- $options_markup .= sprintf( '<option value="%s" %s>%s</option>',
- $key, selected( $value, $key, false ), $label );
- }
- printf( '<select name="%1$s[%2$s]" id="%1$s-%2$s">%3$s</select>',
- $args['option_group'],
- $args['name'],
- $options_markup );
- }
- $tip = $args['tip'];
- print('<b class="wntip" title="' . esc_attr($tip) . '"> ? </b></label>');
- }
Add Comment
Please, Sign In to add comment