Skip to content

Instantly share code, notes, and snippets.

@LinzardMac
Created July 6, 2015 18:52
Show Gist options
  • Save LinzardMac/4c8ac8ab9d1fb4c9546e to your computer and use it in GitHub Desktop.
Save LinzardMac/4c8ac8ab9d1fb4c9546e to your computer and use it in GitHub Desktop.
array(
'label' => 'Location',
'desc' => '',
'id' => $prefix.'location',
'type' => 'loc_group',
'options' => array(
'location'=> array(
'options' => array(
'state' => array(
'label' => 'State',
'desc' => '',
'id' => $prefix.'state',
'value' => 'state'
),
'city' => array(
'label' => 'City',
'desc' => '',
'id' => $prefix.'city',
'value' => 'city'
),
'zip_code' => array(
'label' => 'Zip Code',
'desc' => '',
'id' => $prefix.'zip',
'value' => 'zip'
)
)
)
)
)
case 'loc_group':
echo '<div id="'.$field['id'].'" id="'.$field['id'].'">';
foreach ($field['options'] as $option) {
foreach($option['options'] as $the_option){
// have to check if $meta is empty because even if it is, strtotime()/ date() outputs a default value making new posts or
//posts without set times select the options that match the default
echo '<input type="text" class="" name="'.$the_option['value'].'" id="'.$the_option['value'].'" value="'.$meta.'" size="30" /></br>'.$the_option['label'].'</br>';
} //end foreach options as the_option
} //end foreach field as option
echo '</div>';
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment