Permalink
Browse files

Updating with new theme settings file to work with settings API.

  • Loading branch information...
Chris Wallace
Chris Wallace committed Jan 13, 2012
1 parent 069fa00 commit 2d116a0cbfc62eb1188040ccd8df926b204b1a9f
@@ -1,54 +0,0 @@
-<?php
-/* Array Options:
-
- name (string)
- desc (string)
- id (string)
- type (string) - text, color, image, select, multiple, textarea, page, pages, category, categories, text_list
- value (string) - default value - replaced when custom value is entered - (text, color, select, textarea, page, category)
- - For multiple default values in multiple selects, separate with a comma space ("value" => "option 1, options 2")
- - For pages "value" => "Page Name, Page Name 2"
- - For categories "value" => "slug, slug2"
- options (array)
- attr (array) - any form field attributes
- url (string) - for image type only - defines the default image
- default_text (string) - overrides "None" option text in selects
-
- How to use this file:
- 1. Save this template to the 'theme-options' folder in the theme root
- 2. Change the file name to this syntax (remember to add the php extension):
- tab-name_#.php - # is the position you want your tab to appear. Each tab must have a unique ordinal number.
- Example:
- colors-and-images_0.php - will render a tab "Colors and Images" that will be the first on the list.
- 3. Create your options and BAM!
-*/
-if(function_exists('up_seo_default_options'))
- $options = up_seo_default_options();
-
-
-/* ------------ Do not edit below this line ----------- */
-
-//Check if theme options set
-global $default_check;
-global $default_options;
-
-if(!$default_check):
- foreach($options as $option):
- if($option['type'] != 'image'):
- $default_options[$option['id']] = $option['value'];
- else:
- $default_options[$option['id']] = $option['url'];
- endif;
- endforeach;
- $update_option = get_option('up_themes_'.UPTHEMES_SHORT_NAME);
- if(is_array($update_option)):
- $update_option = array_merge($update_option, $default_options);
- update_option('up_themes_'.UPTHEMES_SHORT_NAME, $update_option);
- else:
- update_option('up_themes_'.UPTHEMES_SHORT_NAME, $default_options);
- endif;
-endif;
-
-render_options($options);
-
-?>
@@ -0,0 +1,109 @@
+<?php
+/**
+ * Theme Colors and Images Settings Functions file
+ *
+ * The /theme-options/colors-and-images_0.php file defines
+ * the colors and images options for the Theme.
+ *
+ * How to use this file:
+ * 1) Save this template to the 'theme-options' folder in the Theme root
+ * 2) Change the file name to this syntax (remember to add the .php
+ * extension): tab-name_#.php, where:
+ * - tab-name = Name of the Tab as it will appear in the Admin menu
+ * - # = position tab will appear, relative to other tabs
+ * 3) Add options to the $options array
+ * 4) BOOM!
+ *
+ * To add additional options, add arrays to the $options
+ * array, with each new array containing the following
+ * array keys:
+ * - key name string (required) option name
+ * - key desc string (required) option description
+ * - key id string (required) option slug
+ * - key type string (required) option type; one of: text, color, image, select, multiple, textarea, page, pages, category, categories
+ * - key value string (required) default option value, replaced when custom value is entered (text, color, select, textarea, page, category)
+ * - key options array (optional) associative array of valid options for select-type options, in the form of "Name" => "slug"
+ * - key attr array (optional) form-field attributes
+ * - keys url string (optional) default-image URL, for image-type options
+ *
+ * @package Micro
+ * @copyright Copyright (c) 2011, UpThemes
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, v2 (or newer)
+ *
+ * @since Micro 1.0
+ */
+
+$thistab = array(
+ "name" => "colors_and_images",
+ "title" => __("Colors and Images","upfw"),
+ 'sections' => array(
+ 'color_scheme' => array(
+ 'name' => 'color_scheme',
+ 'title' => __( 'Color Scheme', 'upfw' ),
+ 'description' => __( 'Select your color scheme.','upfw' )
+ )
+ )
+);
+
+$options = array(
+ 'theme_color_scheme' => array(
+ 'tab' => $thistab['name'],
+ "name" => "theme_color_scheme",
+ "title" => "Theme Color Scheme",
+ 'description' => __( 'Display header navigation menu above or below the site title/description?', 'oenology' ),
+ 'section' => 'color_scheme',
+ 'since' => '1.0',
+ "id" => "color_scheme",
+ "type" => "select",
+ "default" => "light",
+ "valid_options" => array(
+ 'light' => array(
+ "name" => "light",
+ "title" => __( 'Light', 'storefrontal' )
+ ),
+ 'dark' => array(
+ "name" => "dark",
+ "title" => __( 'Dark', 'storefrontal' )
+ )
+ )
+ )
+);
+
+register_theme_options($options);
+register_theme_option_tab($thistab);
+
+/*
+array( "name" => "Default Hyperlink Color",
+ "desc" => "Enter a default hyperlink color here.",
+ "id" => "default_link_color",
+ "type" => "color"),
+
+array( "name" => "Hover Hyperlink Color",
+ "desc" => "Enter a hover hyperlink color here.",
+ "id" => "hover_link_color",
+ "type" => "color"),
+
+array( "name" => "Active Hyperlink Color",
+ "desc" => "Enter an active hyperlink color here.",
+ "id" => "active_link_color",
+ "type" => "color"),
+
+array( "name" => "Visited Hyperlink Color",
+ "desc" => "Enter a visited hyperlink color here.",
+ "id" => "visited_link_color",
+ "type" => "color"),
+
+array( "name" => "Content Text Color",
+ "desc" => "Enter a color here for the content text.",
+ "id" => "content_text_color",
+ "type" => "color"),
+
+array( "name" => "Website Favicon",
+ "desc" => "You should upload a small PNG with a size of 16x16.",
+ "id" => "favicon",
+ "value" => "Upload Favicon",
+ "type" => "image")
+
+*/
+
+?>
@@ -1,65 +0,0 @@
-<?php
-
-$options = array (
-
- array( "name" => "Theme Layout",
- "desc" => "Please select the layout for your site.",
- "id" => "layout_global",
- "type" => "layouts",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
- array( "name" => "Theme Layout for Archives",
- "desc" => "Please select the layout for your archives.",
- "id" => "layout_archive",
- "type" => "layouts",
- "context" => "archive",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
- array( "name" => "Theme Layout for Categories",
- "desc" => "Please select the layout for your categories.",
- "id" => "layout_category",
- "type" => "layouts",
- "context" => "category",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
-
- array( "name" => "Theme Layout for Pages",
- "desc" => "Please select the layout for your pages.",
- "id" => "layout_page",
- "type" => "layouts",
- "context" => "page",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
- array( "name" => "Theme Layout for Posts",
- "desc" => "Please select the layout for your posts.",
- "id" => "layout_post",
- "type" => "layouts",
- "context" => "single",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
- array( "name" => "Theme Layout for Author Archives",
- "desc" => "Please select the layout for your author archives.",
- "id" => "layout_author",
- "type" => "layouts",
- "context" => "author",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
- array( "name" => "Theme Layout for Search",
- "desc" => "Please select the layout for your search page.",
- "id" => "layout_search",
- "type" => "layouts",
- "context" => "search",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css'),
-
- array( "name" => "Theme Layout for Tag Archives",
- "desc" => "Please select the layout for your tag archives.",
- "id" => "layout_tag",
- "type" => "layouts",
- "context" => "tag",
- "value" => get_bloginfo('template_directory').'/library/layouts/right-column.css')
-
-
-);
-
-render_options($options);
-?>
@@ -1,52 +0,0 @@
-<?php
-
-$options = array (
-
- array(
- "name" => "Product Titles",
- "desc" => "Select the font and style for product titles.",
- "id" => "product_title",
- "selector" => "h2.prodtitle",
- "type" => "typography",
- "default" => "Buda"),
-
- array(
- "name" => "Widget Titles",
- "desc" => "Select the font and style for widget titles.",
- "id" => "widget_title",
- "selector" => "h3.widgettitle",
- "type" => "typography",
- "default" => "Century Gothic")
-);
-
-/* Add Multple Selector Support */
-if(function_exists('upfw_multiple_typography'))
- $options = upfw_multiple_typography($options);
-
-
-/* ------------ Do not edit below this line ----------- */
-
-//Check if theme options set
-global $default_check;
-global $default_options;
-
-if(!$default_check):
- foreach($options as $option):
- if($option['type'] != 'image'):
- $default_options[$option['id']] = $option['value'];
- else:
- $default_options[$option['id']] = $option['url'];
- endif;
- endforeach;
- $update_option = get_option('up_themes_'.UPTHEMES_SHORT_NAME);
- if(is_array($update_option)):
- $update_option = array_merge($update_option, $default_options);
- update_option('up_themes_'.UPTHEMES_SHORT_NAME, $update_option);
- else:
- update_option('up_themes_'.UPTHEMES_SHORT_NAME, $default_options);
- endif;
-endif;
-
-render_options($options);
-
-?>

0 comments on commit 2d116a0

Please sign in to comment.