public function set_default_color_theme_based_on_theme_settings() { if (function_exists('twentyeleven_get_theme_options')) { $theme_options = twentyeleven_get_theme_options(); $theme_color_scheme = isset($theme_options['color_scheme']) ? $theme_options['color_scheme'] : 'transparent'; } else { $theme_color_scheme = get_theme_mod('color_scheme', 'transparent'); } // Default for $theme_color_scheme is 'transparent' just so it doesn't match 'light' or 'dark' // The default for Jetpack's color scheme is still defined above as 'light' if (false !== stripos($theme_color_scheme, 'light')) { $this->default_color_scheme = 'light'; } elseif (false !== stripos($theme_color_scheme, 'dark')) { $this->default_color_scheme = 'dark'; } }
/** * Set 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 load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To style the visual editor. * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers * and backgrounds, and post formats. * @uses register_nav_menus() To add support for navigation menus. * @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 */ function twentyeleven_setup() { /* * Make Twenty Eleven available for translation. * Translations can be added to 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', get_template_directory() . '/languages'); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // Load up our theme options page and related code. require get_template_directory() . '/inc/theme-options.php'; // Grab Twenty Eleven's Ephemera widget. require get_template_directory() . '/inc/widgets.php'; // Add default posts and comments RSS feed links to <head>. add_theme_support('automatic-feed-links'); // This theme uses wp_nav_menu() in one location. register_nav_menu('primary', __('Primary Menu', 'twentyeleven')); // Add support for a variety of post formats add_theme_support('post-formats', array('aside', 'link', 'gallery', 'status', 'quote', 'image')); $theme_options = twentyeleven_get_theme_options(); if ('dark' == $theme_options['color_scheme']) { $default_background_color = '1d1d1d'; } else { $default_background_color = 'e2e2e2'; } // Add support for custom backgrounds. add_theme_support('custom-background', array('default-color' => $default_background_color)); // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images add_theme_support('post-thumbnails'); // Add support for custom headers. $custom_header_support = array('default-text-color' => '000', 'width' => apply_filters('twentyeleven_header_image_width', 1000), 'height' => apply_filters('twentyeleven_header_image_height', 288), 'flex-height' => true, 'random-default' => true, 'wp-head-callback' => 'twentyeleven_header_style', 'admin-head-callback' => 'twentyeleven_admin_header_style', 'admin-preview-callback' => 'twentyeleven_admin_header_image'); add_theme_support('custom-header', $custom_header_support); if (!function_exists('get_custom_header')) { // This is all for compatibility with versions of WordPress prior to 3.4. define('HEADER_TEXTCOLOR', $custom_header_support['default-text-color']); define('HEADER_IMAGE', ''); define('HEADER_IMAGE_WIDTH', $custom_header_support['width']); define('HEADER_IMAGE_HEIGHT', $custom_header_support['height']); add_custom_image_header($custom_header_support['wp-head-callback'], $custom_header_support['admin-head-callback'], $custom_header_support['admin-preview-callback']); add_custom_background(); } /* * We'll be using post thumbnails for custom header images on posts and pages. * We want them to be the size of the header image that we just defined. * Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. */ set_post_thumbnail_size($custom_header_support['width'], $custom_header_support['height'], true); /* * Add Twenty Eleven's custom image sizes. * Used for large feature (header) images. */ add_image_size('large-feature', $custom_header_support['width'], $custom_header_support['height'], true); // Used for featured posts if a large-feature doesn't exist. add_image_size('small-feature', 500, 300); // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers(array('wheel' => array('url' => '%s/images/headers/wheel.jpg', 'thumbnail_url' => '%s/images/headers/wheel-thumbnail.jpg', 'description' => __('Wheel', 'twentyeleven')), 'shore' => array('url' => '%s/images/headers/shore.jpg', 'thumbnail_url' => '%s/images/headers/shore-thumbnail.jpg', 'description' => __('Shore', 'twentyeleven')), 'trolley' => array('url' => '%s/images/headers/trolley.jpg', 'thumbnail_url' => '%s/images/headers/trolley-thumbnail.jpg', 'description' => __('Trolley', 'twentyeleven')), 'pine-cone' => array('url' => '%s/images/headers/pine-cone.jpg', 'thumbnail_url' => '%s/images/headers/pine-cone-thumbnail.jpg', 'description' => __('Pine Cone', 'twentyeleven')), 'chessboard' => array('url' => '%s/images/headers/chessboard.jpg', 'thumbnail_url' => '%s/images/headers/chessboard-thumbnail.jpg', 'description' => __('Chessboard', 'twentyeleven')), 'lanterns' => array('url' => '%s/images/headers/lanterns.jpg', 'thumbnail_url' => '%s/images/headers/lanterns-thumbnail.jpg', 'description' => __('Lanterns', 'twentyeleven')), 'willow' => array('url' => '%s/images/headers/willow.jpg', 'thumbnail_url' => '%s/images/headers/willow-thumbnail.jpg', 'description' => __('Willow', 'twentyeleven')), 'hanoi' => array('url' => '%s/images/headers/hanoi.jpg', 'thumbnail_url' => '%s/images/headers/hanoi-thumbnail.jpg', 'description' => __('Hanoi Plant', 'twentyeleven')))); }
/** * Implements Twenty Eleven theme options into Theme Customizer * * @since Twenty Eleven 1.3 * * @param object $wp_customize Theme Customizer object. */ function twentyeleven_customize_register($wp_customize) { $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; $options = twentyeleven_get_theme_options(); $defaults = twentyeleven_get_default_theme_options(); $wp_customize->add_setting('twentyeleven_theme_options[color_scheme]', array('default' => $defaults['color_scheme'], 'type' => 'option', 'capability' => 'edit_theme_options')); $schemes = twentyeleven_color_schemes(); $choices = array(); foreach ($schemes as $scheme) { $choices[$scheme['value']] = $scheme['label']; } $wp_customize->add_control('twentyeleven_color_scheme', array('label' => __('Color Scheme', 'twentyeleven'), 'section' => 'colors', 'settings' => 'twentyeleven_theme_options[color_scheme]', 'type' => 'radio', 'choices' => $choices, 'priority' => 5)); // Link Color (added to Color Scheme section in Theme Customizer) $wp_customize->add_setting('twentyeleven_theme_options[link_color]', array('default' => twentyeleven_get_default_link_color($options['color_scheme']), 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link Color', 'twentyeleven'), 'section' => 'colors', 'settings' => 'twentyeleven_theme_options[link_color]'))); // Default Layout $wp_customize->add_section('twentyeleven_layout', array('title' => __('Layout', 'twentyeleven'), 'priority' => 50)); $wp_customize->add_setting('twentyeleven_theme_options[theme_layout]', array('type' => 'option', 'default' => $defaults['theme_layout'], 'sanitize_callback' => 'sanitize_key')); $layouts = twentyeleven_layouts(); $choices = array(); foreach ($layouts as $layout) { $choices[$layout['value']] = $layout['label']; } $wp_customize->add_control('twentyeleven_theme_options[theme_layout]', array('section' => 'twentyeleven_layout', 'type' => 'radio', 'choices' => $choices)); }
<?php /** * The Sidebar containing the main widget area. * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ $options = twentyeleven_get_theme_options(); $current_layout = $options['theme_layout']; if ('content' != $current_layout) { ?> <div id="side"> <!--<div id="saiyo"> <div id="saiyo_pho"><a href="http://www.tabikobo.com/recruit/career/guideline/executive2.html#n02" target="_blank"><img width="190" height="210" src="/img/saiyo_sidebnr.png" alt="バリ好きな方大歓迎!バリ島旅行の専門店「バリガール」の採用情報はこちら"></a></div> </div>--> <div id="side_staff"> <div id="s_staff_title"><img src="/img/side_staff.jpg" width="190" height="380" alt="こだわりの旅を実現。私たち、トラベル・コンシェルジュにお任せください。 ツアー・航空券・各種お問い合わせは 東京03-5956-4170 大阪 06-4861-7263 名古屋 052-259-0681 福岡 092-738-2601 仙台 022-217-4650 札幌 011-223-2251" /></div> <div id="s_staff_f"><a href="mailto:bali@tabikobo.com"><img src="/img/s_mail.gif" width="129" height="13" alt="*****@*****.**" /></a> <p>【営業時間】 月~土(10:00~18:30) <br /> 日・祝(休み)</p> </div> </div> <?php if (is_home() || is_front_page()) { ?>
/** * Adds Twenty Eleven layout classes to the array of body classes. * * @since Twenty Eleven 1.0 */ function twentyeleven_layout_classes($existing_classes) { $options = twentyeleven_get_theme_options(); $current_layout = $options['theme_layout']; if (in_array($current_layout, array('content-sidebar', 'sidebar-content'))) { $classes = array('two-column'); } else { $classes = array('one-column'); } if ('content-sidebar' == $current_layout) { $classes[] = 'right-sidebar'; } elseif ('sidebar-content' == $current_layout) { $classes[] = 'left-sidebar'; } else { $classes[] = $current_layout; } $classes = apply_filters('twentyeleven_layout_classes', $classes, $current_layout); return array_merge($existing_classes, $classes); }
/** Enqueue the stylesheet for the current color scheme into the child theme. */ function twentyelevenchild_enqueue_color_scheme() { $options = twentyeleven_get_theme_options(); $color_scheme = $options['color_scheme']; if ('dark' == $color_scheme) { if (file_exists(get_stylesheet_directory_uri() . '/colors/dark.css')) { wp_enqueue_style('dark_child', get_stylesheet_directory_uri() . '/colors/dark.css', array(), null); do_action('twentyelevenchild_enqueue_color_scheme', 'dark_child'); } } }