Example #1
0
/**
 * Add a style block to the theme for the current link color.
 *
 * This function is attached to the wp_head action hook.
 *
 * @since Twenty Eleven 1.0
 */
function twentyeleven_print_link_color_style()
{
    $options = twentyeleven_get_theme_options();
    $link_color = $options['link_color'];
    $default_options = twentyeleven_get_default_theme_options();
    // Don't do anything if the current link color is the default.
    if ($default_options['link_color'] == $link_color) {
        return;
    }
    ?>
	<style>
		/* Link color */
		a,
		#site-title a:focus,
		#site-title a:hover,
		#site-title a:active,
		.entry-title a:hover,
		.entry-title a:focus,
		.entry-title a:active,
		.widget_twentyeleven_ephemera .comments-link a:hover,
		section.recent-posts .other-recent-posts a[rel="bookmark"]:hover,
		section.recent-posts .other-recent-posts .comments-link a:hover,
		.format-image footer.entry-meta a:hover,
		#site-generator a:hover {
			color: <?php 
    echo $link_color;
    ?>
;
		}
		section.recent-posts .other-recent-posts .comments-link a:hover {
			border-color: <?php 
    echo $link_color;
    ?>
;
		}
		article.feature-image.small .entry-summary p a:hover,
		.entry-header .comments-link a:hover,
		.entry-header .comments-link a:focus,
		.entry-header .comments-link a:active,
		.feature-slider a.active {
			background-color: <?php 
    echo $link_color;
    ?>
;
		}
	</style>
<?php 
}
/**
 * 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));
}
/**
 * Add a style block to the theme for the current link color.
 *
 * This function is attached to the wp_head action hook.
 *
 * @since Twenty Eleven 1.0
 */
function twentyeleven_print_link_color_style()
{
    $options = twentyeleven_get_theme_options();
    $link_color = $options['link_color'];
    $default_options = twentyeleven_get_default_theme_options();
    // Don't do anything if the current link color is the default.
    if ($default_options['link_color'] == $link_color) {
        return;
    }
    ?>
	<style>
		/* Link color */
		a,
		#site-title a:focus,
		#site-title a:hover,
		#site-title a:active,
		.entry-title a:hover,
		.entry-title a:focus,
		.entry-title a:active,
		.widget_twentyeleven_ephemera .comments-link a:hover,
		section.recent-posts .other-recent-posts a[rel="bookmark"]:hover,
		section.recent-posts .other-recent-posts .comments-link a:hover,
		.format-image footer.entry-meta a:hover,
		#site-generator a:hover {
			color: <?php 
    echo $link_color;
    ?>
;
		}
		section.recent-posts .other-recent-posts .comments-link a:hover {
			border-color: <?php 
    echo $link_color;
    ?>
;
		}
		article.feature-image.small .entry-summary p a:hover,
		.entry-header .comments-link a:hover,
		.entry-header .comments-link a:focus,
		.entry-header .comments-link a:active,
		.feature-slider a.active {
			background-color: <?php 
    echo $link_color;
    ?>
;
		}
		.widget .pwaimg, #authorgrid a img {padding:5px;border:1px solid <?php 
    echo $link_color;
    ?>
 !important;margin-bottom:10px;vertical-align:top !important;}
		/*.pwaplusphp_img_nf, .pwaplusphp_img{border:1px solid <?php 
    echo $link_color;
    ?>
 !important;}*/
	</style>
<?php 
}