Skip to content

Instantly share code, notes, and snippets.

@cmcculloh
Created November 23, 2011 05:55
Show Gist options
  • Save cmcculloh/1387983 to your computer and use it in GitHub Desktop.
Save cmcculloh/1387983 to your computer and use it in GitHub Desktop.
global callback
function your_global_callback($field){
$selected = get_option($field["id"]);
if($field["type"] == "text"){
?>
<input type="text" name="<?php echo $field["id"]; ?>" id="<?php echo $field["id"]; ?>" value="<?php echo $selected ?>">
<?php
}else if($field["type"] == "checkbox"){
if($selected){
$selText = ' checked="checked" ';
}else{
$selText = ' ';
}
?>
<input type="checkbox" name="<?php echo $field["id"]; ?>" id="<?php echo $field["id"]; ?>" <?php echo $selText; ?>>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment