gotlisch
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
I’m also having this problem, joining this thread so that I know when there’s an update.
Cheers,
MForum: Themes and Templates
In reply to: get_options isn't returning a value when used inside sidebar.phpHi Steven, $shortname is a global varible…it’s just being used as a prefix to make sure my global varibles don’t conflict with any other ones.. this is how it’s been setup in the settings.php file:
<?php $themename = "Simple Grid"; $shortname = "simple_grid"; $settings_list = array( 'home_page_heading_ln1', 'home_page_heading_ln2', 'home_page_sub_heading', 'google_maps_heading', 'custom_logo_url', 'featured_banner_url', 'custom_background_color', 'facebook_link', 'twitter_link', 'dribbble_link', 'google_plus_link', 'pinterest_link', 'home_page_title', 'post_hover_background_color' ); /*function add_homestead_scripts() { // wp_enqueue_script('homestead-settings1', WP_CONTENT_URL.'/themes/homestead/jquery.js'); wp_enqueue_script('homestead-settings2', WP_CONTENT_URL.'/themes/homestead/jquery-1.4.2.min.js'); wp_enqueue_script('homestead-settings3', WP_CONTENT_URL.'/themes/homestead/jpicker-1.1.3.min.js'); //wp_enqueue_script('homestead-settings1', WP_CONTENT_URL.'/themes/homestead/css/colorpicker.css'); }*/ function mytheme_add_admin() { global $themename, $shortname, $settings_list; if ( $_GET['page'] == basename(__FILE__) ) { if ( 'save' == $_REQUEST['action'] ) { foreach($settings_list as $value) { //echo '<script type="text/javascript">alert("' . $value . '");</script>'; //if($_REQUEST[$value] != "") //update_option($shortname . '_' . $value,$_REQUEST[$value]); update_option($shortname . '_' . $value,mysql_real_escape_string($_REQUEST[$value])); } header("Location: themes.php?page=settings.php&saved=true"); die; } } add_theme_page($themename." Settings", $themename." Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin'); } function mytheme_admin() { global $themename, $shortname, $settings_list; 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>'; ?> <style type="text/css"> table { border: none; } td { padding: 5px; } .ss_text { width: 350px; } </style> <div class="wrap"> <h2><?php echo $themename; ?> Theme Options</h2> <form method="post"> <table> <tr> <td>Home Page Heading ln1:</td> <td><input type="text" name="home_page_heading_ln1" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_home_page_heading_ln1',''))); ?>" /></td></tr> <tr> ....
Viewing 2 replies - 1 through 2 (of 2 total)