//create settings page
function wptimeline_settings() {
?>
<div class="wrap">
<h2><?php _e('Timeline Settings', WPTIMELINE_UNIQUE); ?></h2>
<div id="timeline_quick_links">
<?php /*include('inc/timeline_links.php'); */?>
</div>
<?php
if (isset($_GET['updated']) && $_GET['updated'] == 'true') {
?>
<div id="message" class="updated fade"><p><strong><?php _e('Settings Updated', WPTIMELINE_UNIQUE); ?></strong></p></div>
<?php
}
?>
<form method="post" action="<?php echo esc_url('options.php');?>">
<div>
<?php settings_fields('timeline-settings'); ?>
</div>
<?php
$options = timeline_set_options();
?>
<table class="form-table">
<?php foreach($options as $option){ ?>
<?php
//if option type is a dropdown, do this
if ( $option['input_type'] == 'dropdown'){ ?>
<tr valign="top">
<th scope="row"><?php _e($option['desc'], WPTIMELINE_UNIQUE); ?></th>
<td><select id="<?php echo $option['name']; ?>" name="<?php echo $option['name']; ?>">
<?php foreach($option['data'] as $opt => $value){ ?>
<option <?php if(get_option($option['name']) == $value){ echo 'selected="selected"';}?> name="<?php echo $option['name']; ?>" value="<?php echo $value; ?>"><?php echo $opt ; ?></option>
<? } //endforeach ?>
</select>
</td>
</tr>
<?php
//if option type is text, do this
}elseif ( $option['input_type'] == 'text'){ ?>
<tr valign="top">
<th scope="row"><?php _e($option['desc'], WPTIMELINE_UNIQUE); ?></th>
<td><input id="<?php echo $option['name']; ?>" name="<?php echo $option['name']; ?>" value="<?php echo get_option($option['name']); ?>" />
</td>
</tr>
<?php
}else{} //endif
} //endforeach ?>
</table>
<p class="submit"><input type="submit" class="button-primary" value="<?php _e('Update', WPTIMELINE_UNIQUE); ?>" /></p>
</form>
</div>
<?php
}