Custom Theme Options on multisite not working
-
Hi there.
I made a theme which contains an custom the options panel.
When I install the theme on a single wordpress blog it works perfect.
But when I install the samen theme on a blog in an multisite setup, it fails.
Users can add and edit the custom theme options, and the’re being saved but in the frontpage theses eddited settings don’t show up.Here’s the code in header.php, where the problem seems to be:
<? /* This code retrieves all our admin options. */ global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); } } ?> <? /* If a title has been provided, we'll use that. */ if ($bl_intro_title) { ?> <h1><? echo $bl_intro_title; ?></h1> <? /* Otherwise we'll use a generic message. */ } else { ?> <h1>Activiteiten bij Hoeve Bouwlust</h1> <? } ?>
Here’s the code in functions.php:
<? $themename = "Hoeve Bouwlust Main"; $shortname = "bl"; $options = array ( array( "name" => "Intro Stukje", "type" => "title"), array( "type" => "open"), array( "name" => "Titel", "desc" => "Wat wordt de titel van het intro stukje?", "id" => $shortname."_intro_title", "std" => "", "type" => "text"), array( "name" => "Intro Tekst", "desc" => "De tekst van het intro stukje", "id" => $shortname."_intro_text", "type" => "textarea"), array( "type" => "close") ); function blmain_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'], stripslashes($_REQUEST[ $value['id'] ] ) ); } else { delete_option( $value['id'] ); } } header("Location: themes.php?page=functions.php&saved=true"); die; } else if( 'reset' == $_REQUEST['action'] ) { foreach ($options as $value) { delete_option( $value['id'] ); } header("Location: themes.php?page=functions.php&reset=true"); die; } } add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'blmain_admin'); } function blmain_admin() { global $themename, $shortname, $options; if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>De thema instellingen zijn opgeslagen.</strong></p></div>'; if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>De thema instellingen zijn gereset.</strong></p></div>'; ?> <div class="wrap"> <h2><?php echo $themename; ?> thema instellingen</h2> <form method="post"> <?php foreach ($options as $value) { switch ( $value['type'] ) { case "open": ?> <table width="100%" border="0" style="background-color:#eef5fb; padding:10px;"> <?php break; case "close": ?> </table> <?php break; case "title": ?> <table width="100%" border="0" style="background-color:#dceefc; padding:5px 10px;"><tr> <td colspan="2"><h3 style="font-family:Georgia,'Times New Roman',Times,serif;"><?php echo $value['name']; ?></h3></td> </tr> <?php break; case 'text': ?> <tr> <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> <td width="80%"><input style="width:400px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /></td> </tr> <tr> <td><small><?php echo $value['desc']; ?></small></td> </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;">?</td></tr><tr><td colspan="2">?</td></tr> <?php break; case 'textarea': ?> <tr> <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> <td width="80%"><textarea name="<?php echo $value['id']; ?>" style="width:400px; height:200px;" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?></textarea></td> </tr> <tr> <td><small><?php echo $value['desc']; ?></small></td> </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;">?</td></tr><tr><td colspan="2">?</td></tr> <?php break; case 'select': ?> <tr> <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> <td width="80%"><select style="width:240px;" 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"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?></select></td> </tr> <tr> <td><small><?php echo $value['desc']; ?></small></td> </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;">?</td></tr><tr><td colspan="2">?</td></tr> <?php break; case "checkbox": ?> <tr> <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> <td width="80%"><? if(get_settings($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; ?> /> </td> </tr> <tr> <td><small><?php echo $value['desc']; ?></small></td> </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;">?</td></tr><tr><td colspan="2">?</td></tr> <?php break; } } ?> <!--</table>--> <p class="submit"> <input name="save" type="submit" value="Instellingen opslaan" /> <input type="hidden" name="action" value="save" /> </p> </form> <form method="post"> <p class="submit"> <input name="reset" type="submit" value="Reset instellingen" /> <input type="hidden" name="action" value="reset" /> </p> </form> <?php } add_action('admin_menu', 'blmain_add_admin'); ?>
Viewing 14 replies - 1 through 14 (of 14 total)
Viewing 14 replies - 1 through 14 (of 14 total)
- The topic ‘Custom Theme Options on multisite not working’ is closed to new replies.