diff --git a/wp-content/themes/twentyeleven/colors/dark.css b/wp-content/themes/twentyeleven/colors/dark.css new file mode 100644 index 000000000..974b25fd8 --- /dev/null +++ b/wp-content/themes/twentyeleven/colors/dark.css @@ -0,0 +1 @@ +/* Placeholder for a Twenty Eleven dark color scheme */ \ No newline at end of file diff --git a/wp-content/themes/twentyeleven/functions.php b/wp-content/themes/twentyeleven/functions.php index 5ebb362b8..2b35f0119 100644 --- a/wp-content/themes/twentyeleven/functions.php +++ b/wp-content/themes/twentyeleven/functions.php @@ -1,22 +1,43 @@ + * add_action( 'after_setup_theme', 'my_child_theme_setup' ); + * function my_child_theme_setup() { + * // We are providing our own filter for excerpt_length (or using the unfiltered value) + * remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' ); + * ... + * } + * + * + * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. + * * @package WordPress * @subpackage Twenty Eleven + * @since Twenty Eleven 1.0 */ -/** - * Make theme available for translation - * Translations can be filed in the /languages/ directory - * If you're building a theme based on Twenty Eleven, use a find and replace - * to change 'twentyeleven' to the name of your theme in all the template files - */ -load_theme_textdomain( 'twentyeleven', TEMPLATEPATH . '/languages' ); - -$locale = get_locale(); -$locale_file = TEMPLATEPATH . "/languages/$locale.php"; -if ( is_readable( $locale_file ) ) - require_once( $locale_file ); - /** * Set the content width based on the theme's design and stylesheet. */ @@ -24,53 +45,110 @@ if ( ! isset( $content_width ) ) $content_width = 584; /** - * This theme uses wp_nav_menu() in one location. + * Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run. */ -register_nav_menus( array( - 'primary' => __( 'Primary Menu', 'twentyeleven' ), -) ); +add_action( 'after_setup_theme', 'twentyeleven_setup' ); +if ( ! function_exists( 'twentyeleven_setup' ) ): /** - * Add default posts and comments RSS feed links to head + * Sets up theme defaults and registers support for various WordPress features. + * + * Note that this function is hooked into the after_setup_theme hook, which runs + * before the init hook. The init hook is too late for some features, such as indicating + * support post thumbnails. + * + * To override twentyeleven_setup() in a child theme, add your own twentyeleven_setup to your child theme's + * functions.php file. + * + * @uses add_theme_support() To add support for post thumbnails and automatic feed links. + * @uses register_nav_menus() To add support for navigation menus. + * @uses add_custom_background() To add support for a custom background. + * @uses load_theme_textdomain() For translation/localization support. + * @uses add_custom_image_header() To add support for a custom header. + * @uses register_default_headers() To register the default custom header images provided with the theme. + * @uses set_post_thumbnail_size() To set a custom post thumbnail size. + * + * @since Twenty Eleven 1.0 */ -add_theme_support( 'automatic-feed-links' ); +function twentyeleven_setup() { -/** - * Add support for an Aside Post Format - */ -add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote' ) ); + /** + * Make theme available for translation + * Translations can be filed in the /languages/ directory + * If you're building a theme based on Twenty Eleven, use a find and replace + * to change 'twentyeleven' to the name of your theme in all the template files + */ + load_theme_textdomain( 'twentyeleven', TEMPLATEPATH . '/languages' ); -/** - * Add support for custom backgrounds - */ -add_custom_background(); + $locale = get_locale(); + $locale_file = TEMPLATEPATH . "/languages/$locale.php"; + if ( is_readable( $locale_file ) ) + require_once( $locale_file ); -// This theme uses Feature Images for per-post/per-page Custom Header images -add_theme_support( 'post-thumbnails' ); + /** + * Load up our theme options page + */ + require( dirname( __FILE__ ) . '/inc/theme-options/theme-options.php' ); -/** - * Add support for Custom Headers - */ -define( 'HEADER_TEXTCOLOR', '000' ); + /** + * Grab Twenty Eleven's Custom Widgets + */ + require( dirname( __FILE__ ) . '/inc/widgets.php' ); -// No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI. -define( 'HEADER_IMAGE', '%s/images/headers/default.jpg' ); + /** + * Add default posts and comments RSS feed links to head + */ + add_theme_support( 'automatic-feed-links' ); -// The height and width of your custom header. You can hook into the theme's own filters to change these values. -// Add a filter to twentyeleven_header_image_width and twentyeleven_header_image_height to change these values. -define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) ); -define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 300 ) ); + /** + * This theme uses wp_nav_menu() in one location. + */ + register_nav_menus( array( + 'primary' => __( 'Primary Menu', 'twentyeleven' ), + ) ); -// We'll be using post thumbnails for custom header images on posts and pages. -// We want them to be 940 pixels wide by 198 pixels tall. -// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. -set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); + /** + * Add support for an Aside Post Format + */ + add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote' ) ); -// Add a way for the custom header to be styled in the admin panel that controls -// custom headers. See twentyeleven_admin_header_style(), below. -add_custom_image_header( 'twentyeleven_header_style', 'twentyeleven_admin_header_style', 'twentyeleven_admin_header_image' ); + /** + * Add support for custom backgrounds + */ + add_custom_background(); -// ... and thus ends the changeable header business. + // This theme uses Feature Images for per-post/per-page Custom Header images + add_theme_support( 'post-thumbnails' ); + + /** + * Add support for Custom Headers + */ + define( 'HEADER_TEXTCOLOR', '000' ); + + // No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI. + define( 'HEADER_IMAGE', '%s/images/headers/default.jpg' ); + + // The height and width of your custom header. You can hook into the theme's own filters to change these values. + // Add a filter to twentyeleven_header_image_width and twentyeleven_header_image_height to change these values. + define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) ); + define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 300 ) ); + + // We'll be using post thumbnails for custom header images on posts and pages. + // We want them to be 940 pixels wide by 198 pixels tall. + // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. + set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); + + // Add Twenty Eleven's custom image sizes + add_image_size( 'large-feature', HEADER_IMAGE_WIDTH, 500, true ); // Used for large feature images + add_image_size( 'small-feature', 500, 500 ); // Used for featured posts if a large-feature doesn't exist + + // Add a way for the custom header to be styled in the admin panel that controls + // custom headers. See twentyeleven_admin_header_style(), below. + add_custom_image_header( 'twentyeleven_header_style', 'twentyeleven_admin_header_style', 'twentyeleven_admin_header_image' ); + + // ... and thus ends the changeable header business. +} +endif; // twentyeleven_setup if ( ! function_exists( 'twentyeleven_header_style' ) ) : /** @@ -79,6 +157,7 @@ if ( ! function_exists( 'twentyeleven_header_style' ) ) : * @since Twenty Eleven 1.0 */ function twentyeleven_header_style() { + // If no custom options for text are set, let's bail // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value if ( HEADER_TEXTCOLOR == get_header_textcolor() ) @@ -108,7 +187,7 @@ function twentyeleven_header_style() { max_num_pages > 1 ) : ?> diff --git a/wp-content/themes/twentyeleven/inc/theme-options/images/content-sidebar.png b/wp-content/themes/twentyeleven/inc/theme-options/images/content-sidebar.png new file mode 100644 index 000000000..f4d479471 Binary files /dev/null and b/wp-content/themes/twentyeleven/inc/theme-options/images/content-sidebar.png differ diff --git a/wp-content/themes/twentyeleven/inc/theme-options/images/content.png b/wp-content/themes/twentyeleven/inc/theme-options/images/content.png new file mode 100644 index 000000000..6cf1da4aa Binary files /dev/null and b/wp-content/themes/twentyeleven/inc/theme-options/images/content.png differ diff --git a/wp-content/themes/twentyeleven/inc/theme-options/images/dark.png b/wp-content/themes/twentyeleven/inc/theme-options/images/dark.png new file mode 100644 index 000000000..55eda6679 Binary files /dev/null and b/wp-content/themes/twentyeleven/inc/theme-options/images/dark.png differ diff --git a/wp-content/themes/twentyeleven/inc/theme-options/images/light.png b/wp-content/themes/twentyeleven/inc/theme-options/images/light.png new file mode 100644 index 000000000..51b1b7a80 Binary files /dev/null and b/wp-content/themes/twentyeleven/inc/theme-options/images/light.png differ diff --git a/wp-content/themes/twentyeleven/inc/theme-options/images/sidebar-content.png b/wp-content/themes/twentyeleven/inc/theme-options/images/sidebar-content.png new file mode 100644 index 000000000..de5202370 Binary files /dev/null and b/wp-content/themes/twentyeleven/inc/theme-options/images/sidebar-content.png differ diff --git a/wp-content/themes/twentyeleven/inc/theme-options/theme-options.css b/wp-content/themes/twentyeleven/inc/theme-options/theme-options.css new file mode 100644 index 000000000..61cb64d02 --- /dev/null +++ b/wp-content/themes/twentyeleven/inc/theme-options/theme-options.css @@ -0,0 +1,22 @@ +#wpcontent select option { + padding-right: 5px; +} +.image-radio-option td { + padding-top: 15px; +} +.image-radio-option label { + display: block; + float: left; + margin: 0 30px 20px 2px; + position: relative; +} +.image-radio-option input { + margin: 0 0 10px; +} +.image-radio-option span { + display: block; + width: 136px; +} +.image-radio-option img { + margin: 0 0 0 -2px; +} \ No newline at end of file diff --git a/wp-content/themes/twentyeleven/inc/theme-options/theme-options.js b/wp-content/themes/twentyeleven/inc/theme-options/theme-options.js new file mode 100644 index 000000000..c09796ba9 --- /dev/null +++ b/wp-content/themes/twentyeleven/inc/theme-options/theme-options.js @@ -0,0 +1,39 @@ +var farbtastic; +function pickColor(a) { + farbtastic.setColor(a); + jQuery("#link-color").val(a); + jQuery("#link-color").css("background-color", a); +} +jQuery(document).ready(function() { + jQuery("#pickcolor").click(function() { + jQuery("#colorPickerDiv").show(); + return false; + }); + jQuery("#link-color").keyup(function() { + var b = jQuery("#link-color").val(), + a = b; + if (a.charAt(0) != "#") { + a = "#" + a; + } + a = a.replace(/[^#a-fA-F0-9]+/, ""); + if (a != b) { + jQuery("#link-color").val(a); + } + if (a.length == 4 || a.length == 7) { + pickColor(a); + } + }); + farbtastic = jQuery.farbtastic("#colorPickerDiv", + function(a) { + pickColor(a); + }); + pickColor(jQuery("#link-color").val()); + jQuery(document).mousedown(function() { + jQuery("#colorPickerDiv").each(function() { + var a = jQuery(this).css("display"); + if (a == "block") { + jQuery(this).fadeOut(2); + } + }); + }); +}); \ No newline at end of file diff --git a/wp-content/themes/twentyeleven/inc/theme-options/theme-options.php b/wp-content/themes/twentyeleven/inc/theme-options/theme-options.php new file mode 100644 index 000000000..6f576838f --- /dev/null +++ b/wp-content/themes/twentyeleven/inc/theme-options/theme-options.php @@ -0,0 +1,316 @@ + array( + 'value' => 'light', + 'label' => __( 'Light', 'twentyeleven' ) + ), + 'dark' => array( + 'value' => 'dark', + 'label' => __( 'Dark', 'twentyeleven' ) + ), + ); + + return $color_scheme_options; +} + +/** + * Return array for our layout options + */ +function twentyeleven_layouts() { + $layout_options = array( + 'content-sidebar' => array( + 'value' => 'content-sidebar', + 'label' => __( 'Content on left', 'twentyeleven' ), + ), + 'sidebar-content' => array( + 'value' => 'sidebar-content', + 'label' => __( 'Content on right', 'twentyeleven' ) + ), + 'content' => array( + 'value' => 'content', + 'label' => __( 'One-column, no Sidebar', 'twentyeleven' ) + ), + ); + + return $layout_options; +} + +/** + * Return the current Twenty Eleven theme options, with default values as fallback + */ +function twentyeleven_get_theme_options() { + $defaults = array( + 'color_scheme' => 'light', + 'link_color' => '1b8be0', + 'theme_layout' => 'content-sidebar', + ); + $options = get_option( 'twentyeleven_theme_options', $defaults ); + + return $options; +} + +/** + * Create the options page + */ +function theme_options_do_page() { + if ( ! isset( $_REQUEST['settings-updated'] ) ) + $_REQUEST['settings-updated'] = false; + + ?> +
+ " . get_current_theme() . __( ' Theme Options', 'twentyeleven' ) . ""; ?> + + +

+ + +
+ + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+
+
+ + + +
+ +
+
+
+ +
+ +
+ +
+
+ +

+ +

+
+
+ + +