How we show dropdown pages values in admin sites When we Click on save button?
Question
add_settings_field (
'WhattsApp_Advance_Pages_fld', // ID used to identify the field throughout the theme
esc_html__('Where you Want To display?', 'Woo-WhattsApp'), // The label to the left of the option interface element
array($this, 'WhatsApp_Advance_Pages_Callback'), // The name of the function responsible for rendering the option interface
'WhatsApp_Advance_Settings_page', // The page on which this option will be displayed
'WhatsApp_Advance_Settings' // The name of the section to which this field belongs
);
register_setting(
'WhatsApp_Advance_Settings',
'WhattsApp_Advance_Pages_fld'
);
//CallBack function
public function WhatsApp_Advance_Pages_Callback() {
?>
<select name="WhattsApp_Advance_Pages_fld" id="WhattsApp_Advance_Pages_fld" data-placeholder="Choose Pages..." class="chosen-select" multiple="" tabindex="-1">;
<option value="all" <?php ( "all") ?>
>
<?php echo esc_html__("All", 'Woo-WhattsApp'); ?>
</option>
<option value="Shop" <?php echo esc_attr(get_option('WhattsApp_Advance_Pages_fld')); ?>
>
<?php echo esc_html__("Shop", 'Woo-WhattsApp'); ?>
</option>
<option value="Product" <?php echo esc_attr(get_option('WhattsApp_Advance_Pages_fld')); ?>
>
<?php echo esc_html__("Product", 'Woo-WhattsApp'); ?>
</option>
<option value="product-category" <?php echo esc_attr(get_option('WhattsApp_Advance_Pages_fld')); ?>
>
<?php echo esc_html__("product-category", 'Woo-WhattsApp'); ?>
</option>
<option value="Products taggs" <?php ( "Products taggs") ?>
>
<?php echo esc_html__("Products-taggs", 'Woo-WhattsApp'); ?>
</option>
</select>
<?php
}
0
dropdown, select, wp-admin
3 years
2020-08-06T08:10:25-05:00
2020-08-06T08:10:25-05:00 0 Answers
54 views
0
Leave an answer