1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
public static function registersettings() {
add_settings_section('HH_options_section','Parametres',function (){
echo "Vous pouvez gérer les options du site";
},self::GROUP);
$nomduchamp = 'company_adresse';
$intituledhchamp = "Adresse complète";
$fieldName= 'HH_options_adresse';
register_setting( self::GROUP, $nomduchamp);
add_settings_field($fieldName,$intituledhchamp,self::getchamp($nomduchamp),self::GROUP,'HH_options_section');
$nomduchamp = 'company_telephone';
$intituledhchamp = "Téléphone";
$fieldName= 'HHl_options_telephone';
register_setting( self::GROUP, $nomduchamp);
add_settings_field($fieldName,$intituledhchamp,self::getchamp($nomduchamp),self::GROUP,'HH_options_section');
}
public static function getChamp(string $nomduchamp)
{
return '<input type="text" name="'.$nomduchamp.'" value="'.esc_html(get_option($nomduchamp)).'" style="width:100%">';
} |
Partager