As per my experience isset will not work for text, textarea it will work for checkbox, radio etc (may be someone can guide you in depth for this)
To set option with dropdown selection I would prefer to use switch and case as below
<?php
switch (get_option('your_option_id')) {
case "Default": ?>
<link rel="stylesheet" href="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_url'); ?>/css/default.css" media="screen" />
<?php break;
case "Red": ?>
<link rel="stylesheet" href="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_url'); ?>/css/red.css" media="screen" />
<?php break;
case "Blue": ?>
<link rel="stylesheet" href="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_url'); ?>/css/blue.css" media="screen" />
<?php break;
case "Green": ?>
<link rel="stylesheet" href="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_url'); ?>/css/green.css" media="screen" />
<?php break;
case "Yellow": ?>
<link rel="stylesheet" href="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_url'); ?>/css/yellow.css" media="screen" />
<?php break;
case "Black": ?>
<link rel="stylesheet" href="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_url'); ?>/css/black.css" media="screen" />
<?php break;
}
?>
This you can directly place into the header where we call stylesheet or you can create function for that too. I usually create function so theme file doesn’t become too large.
to check isset you can use != for text and that will work without any issue so can use something below.
<?php
if(get_option('myfeed_url') != '') {
//do this (place your code here)
}
?>
As I say in above line. You can directly place code to the appropriate place (in your case header.php tab may be) or can create function in function.php and than you have to call the function at appropriate place.
Hope this is what you are looking for
—[ Use This Tested Code ]————————————————-
<?php
$themename = "WIS";
$shortname = "wis";
$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
$wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}
array_unshift($wp_cats, "Choose a category");
// your stylesheet selection options
//$alt_stylesheets = array("default.css" => "Default", "blue.css" => "Blue", "white.css" => "White", "visual.css" => "Visual");
// or you can directly call value with below line
$alt_stylesheets = array("default.css", "blue.css", "white.css", "visual.css");
$options = array (
array( "name" => $themename." Options",
"type" => "title"),
array( "name" => "Your section title here",
"type" => "section"),
array( "type" => "open"),
array("name" => __('Colour Scheme','wis'),
"desc" => __('Select a colour scheme for the theme. Future versions will have multiple styles.','wis'),
"id" => "alt_stylesheet",
"type" => "select",
"options" => $alt_stylesheets,
"std" => "white.css"),
array("name" => __('Colour Scheme','wis'),
"desc" => __('Select a colour scheme for the theme. Future versions will have multiple styles.','wis'),
"id" => "alt_no",
"type" => "radio",
"options" => array("yes" => "Yes", "no" => "Nope"),
"std" => "no"),
array("name" => __('Header Display Ad','wis'),
"desc" => __('You can show a display ad in header. Paste the code here for 600px by 60px ad.','wis'),
"id" => "topbanner",
"std" => "",
"type" => "textarea"),
array("name" => __('Hide Footer Navigation Links','wis'),
"desc" => __('Select to hide the navigation bar in the footer. If you want to customize the footer navigation, go to Menus under the Appearance tab in the dashboard.','wis'),
"id" => "hide_footer_nav",
"std" => "",
"type" => "checkbox"),
array("name" => __('Twitter ID','wis'),
"desc" => __('Your Twitter user name, please. It will be shown in the navigation bar. Leaving it blank will keep the Twitter icon supressed.','wis'),
"id" => "twitterid",
"type" => "text",
"std" => ""),
array( "type" => "close"),
array( "type" => "close")
);
function wis_add_admin() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
header("Location: admin.php?page=theme-option.php&saved=true");
die;
}
else if( 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("Location: admin.php?page=theme-option.php&reset=true");
die;
}
}
add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'wis_admin');
}
function wis_add_init() {
$file_dir=get_bloginfo('template_directory');
wp_enqueue_style("functions", $file_dir."/include/functions/functions.css", false, "1.0", "all");
wp_enqueue_script("rm_script", $file_dir."/include/functions/rm_script.js", false, "1.0");
}
function wis_admin() {
global $themename, $shortname, $options;
$i=0;
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
?>
<div class="wrap rm_wrap">
<h2><?php echo $themename; ?> Settings</h2>
<div class="rm_opts">
<form method="post">
<?php foreach ($options as $value) {
switch ( $value['type'] ) {
case "open":
?>
<?php break;
case "close":
?>
</div>
</div>
<br />
<?php break;
case "title":
?>
<p>To easily use the <?php echo $themename;?> theme, you can use the menu below.</p>
<?php break;
case 'text':
?>
<div class="rm_input rm_text">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?>" />
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php
break;
case 'textarea':
?>
<div class="rm_input rm_textarea">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea>
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php
break;
case 'select':
?>
<div class="rm_input rm_select">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $option) { ?>
<option <?php if (get_settings( $value['id'] ) == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>
</select>
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php
break;
case "radio":
?>
<div class="options_input options_select">
<div class="options_desc"><?php echo $value['desc']; ?></div>
<span class="labels"><label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label></span>
<?php foreach ($value['options'] as $key=>$option) {
$radio_setting = get_option($value['id']);
if($radio_setting != ''){
if ($key == get_option($value['id']) ) {
$checked = "checked=\"checked\"";
} else {
$checked = "";
}
}else{
if($key == $value['std']){
$checked = "checked=\"checked\"";
}else{
$checked = "";
}
}?>
<input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
<?php } ?>
</div>
<?php
break;
case "checkbox":
?>
<div class="rm_input rm_checkbox">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>
<input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php break;
case "section":
$i++;
?>
<div class="rm_section">
<div class="rm_title"><h3><img src="https://wordpress.stackexchange.com/questions/54377/<?php bloginfo("template_directory')?>/include/functions/images/trans.gif" class="inactive" alt="""><?php echo $value['name']; ?></h3><span class="submit"><input name="save<?php echo $i; ?>" type="submit" value="Save changes" />
</span><div class="clearfix"></div></div>
<div class="rm_options">
<?php break;
}
}
?>
<input type="hidden" name="action" value="save" />
</form>
<form method="post">
<p class="submit">
<input name="reset" type="submit" value="Reset" />
<input type="hidden" name="action" value="reset" />
</p>
</form>
</div>
<?php
}
?>
<?php
add_action('admin_init', 'wis_add_init');
add_action('admin_menu', 'wis_add_admin');
?>
I have tested and working fine only you may need to change in this is path of your files (function/function.css etc) Also I have added select, radio, textarea, text and checkbox examples.