how we show dropdown pages values in admin sites When we Click on save button ?Screen Shot Attach

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() {

        ?>

;
<option value=”all”
>

<option value=”Shop”
>

                            </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

    }

Should Save pages values

0
, , , Fakhar alam 3 years 2020-08-06T02:10:21-05:00 0 Answers 45 views 0

Leave an answer

Browse
Browse