Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //theme vars
- $themename = "Fuckin Round";
- $shortname = "fuckinround";
- $options = array();
- function theme_options(){
- global $themename, $shortname, $options;
- $options = array (
- array("name" => "General Settings",
- "type" => "section"),
- array("type" => "open"),
- array("name" => "Type of Logo",
- "desc" => "Select your logo type ( Image or Text )",
- "id" => $shortname."_type_of_logo",
- "type" => "select",
- "options" => array("text", "logo"),
- "std" => "text"),
- array("name" => "Logo Upload",
- "desc" => "Upload images using the native media uploader, or define the URL directly",
- "id" => $shortname."_logo_upload",
- "type" => "imageupload",
- "std" => ""),
- array("name" => "Logo Text",
- "desc" => "Enter text for logo",
- "id" => $shortname."_logo_text",
- "type" => "text",
- "std" => ""),
- array("name" => "Logo Slogan",
- "desc" => "Enter text for logo slogan",
- "id" => $shortname."_logo_slogan",
- "type" => "text",
- "std" => ""),
- array("name" => "Custom Favicon",
- "desc" => "Upload a 16px x 16px Png/Gif image that will represent your website's favicon",
- "id" => $shortname."_favicon_upload",
- "type" => "imageupload",
- "std" => ""),
- array("type" => "close"),
- array("name" => "Styling Options",
- "type" => "section"),
- array("type" => "open"),
- array("name" => "Background Color",
- "desc" => "Pick a color for the background",
- "id" => $shortname."_background_color",
- "type" => "color",
- "std" => "#ffffff"),
- array("name" => "Body Color",
- "desc" => "Pick a color for the body",
- "id" => $shortname."_body_color",
- "type" => "color",
- "std" => "#ffffff"),
- array("type" => "close"),
- array("name" => "Footer Options",
- "type" => "section"),
- array("type" => "open"),
- array("name" => "Copyright Text",
- "desc" => "Enter text for copyright in footer (if empty it will be removed)",
- "id" => $shortname."_footer_text",
- "type" => "text",
- "std" => "Copyright TestSite.com"),
- array("type" => "close")
- );
- }
- //add options page
- function fuckinround_add_admin(){
- global $themename, $shortname, $options;
- if ( $_GET['page'] == basename(__FILE__) ){
- if ( 'save' == $_REQUEST['action'] ) {
- //protect against request forgery
- check_admin_referer('theme-save');
- //save the options
- 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=options/options.php&saved=true");
- die;
- } else if ( 'reset' == $_REQUEST['action'] ) {
- //protect against request forgery
- check_admin_referer('theme-reset');
- //delete the options
- foreach ($option as $value) {
- delete_option( $value['id'] );
- }
- header("Location: themes.php?page=options/options.php&reset=true");
- die;
- }
- }
- add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'fuckinround_admin');
- }
- add_action('admin_menu' , 'fuckinround_add_admin');
- //main function
- function fuckinround_admin() {
- global $themename, $shortname, $options;
- //saved or reset messages
- 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>';
- //form
- ?>
- <header>
- <h1><?php echo $themename; ?></h1>
- </header>
- <aside>
- <?php
- //loop 1
- ?>
- </aside>
- <form method="post">
- <main>
- <?php
- //loop 2
- ?>
- </main>
- <footer>
- <?php wp_nonce_field('theme-save'); ?>
- <p class="submit">
- <input name="save" type="submit" value="Save changes" class="button-primary" />
- <input type="hidden" name="action" value="save" />
- </p>
- </form>
- <form method="post">
- <?php wp_nonce_field('theme-reset'); ?>
- <p class="submit">
- <input name="reset" type="submit" value="Reset changes" />
- <input type="hidden" name="action" value="reset" />
- </p>
- </form>
- </footer>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement