Skip to content

Instantly share code, notes, and snippets.

@rveitch
Last active August 29, 2015 14:25
Show Gist options
  • Save rveitch/6d1c37afc4179ca9ee2f to your computer and use it in GitHub Desktop.
Save rveitch/6d1c37afc4179ca9ee2f to your computer and use it in GitHub Desktop.
WordPress Button Snippet
// Create Dashboard plugin page
function bison_media_page(){
?>
<h1>Reset Defaults</h1>
<form method="post" action="">
<p class="submit">
Load theme default settings: <input name="reset" class="button button-secondary" type="submit" value="Reset to theme default settings" >
<input type="hidden" name="action" value="reset" />
</p>
</form>
<?php
if(isset($_POST['reset'])) {
//update_option('mytheme-options', mytheme_defaults() );
echo '<p style="color:red">Theme settings have been reset and default values loaded</p>';
}
}
function my theme_defaults() {
$defaults = array (
'logo' => '',
'favicon' => '',
'footer' => '',
'facebook-link' => '',
'twitter-link' => '',
'google-plus-link' => '',
'pin-it-link' => '',
'linkedin-link' => '',
'showcase-image' => '',
'showcase-title' => '',
'showcase-text' => '',
'showcase-link' => '',
'menu-color' => '#caeffc',
'header-color' => 'transparent',
'menu-font-color' => '#333',
'widgets-menus-color' => 'transparent',
'footer-color' => '#b7d3e5',
'link-color' => '#000',
'bg-color' => 'transparent',
'showcase-color' => '#f5fefe',
'showcase-font-color' => '#777',
'showcase' => '1',
'comments' => '1',
'reset' => '0'
);
return $defaults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment