codice:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_title' => '<h3>',
'after_title' => '</h3>',
));
function widget_mytheme_search() {
?>
<li class="widget">
<h3>SEARCH</h3>
<form method="get" id="searchform2" action="<?php bloginfo('url'); ?>/">
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s2" /></div>
<div><input type="submit" id="searchsubmit2" value="Search" /></div>
</form>
<?php
}
if ( function_exists('register_sidebar_widget') )
register_sidebar_widget(__('Search'), 'widget_mytheme_search');
$themename = "SimplePlease";
$shortname = "SimplePlease";
$options = array (
array( "name" => "Prologue Header Text (Grey Box on Top of Home Page)",
"id" => "prologue_header",
"std" => "Welcome!",
"type" => "text"),
array( "name" => "Prologue Text",
"id" => "prologue_text",
"std" => "Please enjoy your stay, and subscribe to our RSS feed if you like what you see here.",
"type" => "textarea"),
array( "name" => "Featured Category 1 (Bottom Left Column on Front Page)",
"id" => "featured_cat_1",
"std" => "1",
"type" => "text"),
array( "name" => "Featured Category 2 (Bottom Right Column on Front Page)",
"id" => "featured_cat_2",
"std" => "2",
"type" => "text"),
array( "name" => "Ad 1 Image URL",
"id" => "ad1_img",
"std" => "http://www.amgamers.com/simpleplease/wp-content/themes/simpleplease/images/ad2.jpg",
"type" => "text"),
array( "name" => "Ad 1 Link URL",
"id" => "ad1_link",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 1 Alt Text",
"id" => "ad1_alt",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 2 Image URL",
"id" => "ad2_img",
"std" => "http://www.amgamers.com/simpleplease/wp-content/themes/simpleplease/images/ad2.jpg",
"type" => "text"),
array( "name" => "Ad 2 Link URL",
"id" => "ad2_link",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 2 Alt Text",
"id" => "ad2_alt",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 3 Image URL",
"id" => "ad3_img",
"std" => "http://www.amgamers.com/simpleplease/wp-content/themes/simpleplease/images/ad2.jpg",
"type" => "text"),
array( "name" => "Ad 3 Link URL",
"id" => "ad3_link",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 3 Alt Text",
"id" => "ad3_alt",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 4 Image URL",
"id" => "ad4_img",
"std" => "http://www.amgamers.com/simpleplease/wp-content/themes/simpleplease/images/ad2.jpg",
"type" => "text"),
array( "name" => "Ad 4 Link URL",
"id" => "ad4_link",
"std" => "#",
"type" => "text"),
array( "name" => "Ad 4 Alt Text",
"id" => "ad4_alt",
"std" => "#",
"type" => "text"),
);
function mytheme_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: 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", "Simple Please Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin() {
global $themename, $shortname, $options;
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade">
'.$themename.' settings saved.</p></div>';
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade">
'.$themename.' settings reset.</p></div>';
?>
<div class="wrap">
<h2><?php echo $themename; ?> settings</h2>
You may edit the standard settings for the Simple Please theme from this menu.
<form method="post">
<table class="optiontable">
<?php foreach ($options as $value) {
if ($value['type'] == "text") { ?>
<tr valign="top">
<th scope="row" style="text-align:left;width:200px;padding-bottom:40px;"><?php echo $value['name']; ?>:</th>
<td>
<input name="<?php echo $value['id']; ?>" size="100" 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>
<?php } elseif ($value['type'] == "textarea") { ?>
<tr valign="top">
<th scope="row" style="text-align:left;width:200px;padding-bottom:40px;"><?php echo $value['name']; ?>:</th>
<td style="padding-bottom:40px;">
<textarea name="<?php echo $value['id']; ?>" rows="7" cols="50" 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']; } ?>">
<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>
</textarea>
</td>
</tr>
<?php
}
}
?>
</table>
<p class="submit">
<input name="save" type="submit" value="Save changes" />
<input type="hidden" name="action" value="save" />
</p>
</form>
<form method="post">
<p class="submit">
<input name="reset" type="submit" value="Reset" />
<input type="hidden" name="action" value="reset" />
</p>
</form>
<?php
}
function mytheme_wp_head() { ?>
<?php }
add_action('wp_head', 'mytheme_wp_head');
add_action('admin_menu', 'mytheme_add_admin'); ?>
nel div "area_sinistra_home" sto cercando di far apparire i post ...