samedi 18 mai 2019

Add a checkbox option in the badgeos plugin setting page. If admin enables it then pop up on mobile devices will not appear

i want to add checkbox in my badgeos setting page that admin enable the popup hide on mobile so i think add class .hide_on_mobile { display:none; } on function but i am not fimiliar with function code. kindly anyone help me..

This is my function file i want to add through functions.php

add_filter( 'admin_init' , 'badgeos_register_fields' );  
function badgeos_register_fields() {
register_setting( 'general', 'badgeos_hide_mobile', 'esc_attr' );
add_settings_field('mk_badgeos_hide_mobile', '<label for="badgeos_hide_mobile">'. 'Hide on Mobile' . '</label>' , 'badgeos_fields_html' , 'general' );
}
function badgeos_fields_html() {
$value = get_option( 'badgeos_hide_mobile');
$checked = ($value=='yes') ? 'checked="checked"' : '';
echo '<input type="hidden" name="badgeos_hide_mobile" value="no" /><input id="badgeos_hide_mobile" type="checkbox" checked="checked" name="badgeos_hide_mobile" value="yes" />';
}

.hide_on_mobile {
        display:none;
    }




Aucun commentaire:

Enregistrer un commentaire