/** * Register settings and controls with the Customizer. * * @since 1.0.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function plumr_customizer_register() { global $wp_customize; $wp_customize->add_section('plumr-image', array('title' => __('Front Page Image', 'plumr'), 'description' => __('<p>Use the default image or personalize your site by uploading your own image for the front page 1 widget background.</p><p>The default image is <strong>1600 x 1050 pixels</strong>.</p>', 'plumr'), 'priority' => 75)); $wp_customize->add_setting('plumr-front-image', array('default' => sprintf('%s/images/front-page-1.jpg', get_stylesheet_directory_uri()), 'type' => 'option')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'front-background-image', array('label' => __('Front Image Upload', 'plumr'), 'section' => 'plumr-image', 'settings' => 'plumr-front-image'))); $wp_customize->add_setting('plumr_link_color', array('default' => plumr_customizer_get_default_link_color(), 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'plumr_link_color', array('description' => __('Change the default color for linked titles, menu links, post info links and more.', 'plumr'), 'label' => __('Link Color', 'plumr'), 'section' => 'colors', 'settings' => 'plumr_link_color'))); $wp_customize->add_setting('plumr_accent_color', array('default' => plumr_customizer_get_default_accent_color(), 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'plumr_accent_color', array('description' => __('Change the default color for button hover and the footer widget background.', 'plumr'), 'label' => __('Accent Color', 'plumr'), 'section' => 'colors', 'settings' => 'plumr_accent_color'))); }
/** * Checks the settings for the link color color, accent color, and header * If any of these value are set the appropriate CSS is output * * @since 1.0.0 */ function plumr_css() { $handle = defined('CHILD_THEME_NAME') && CHILD_THEME_NAME ? sanitize_title_with_dashes(CHILD_THEME_NAME) : 'child-theme'; $color_link = get_theme_mod('plumr_link_color', plumr_customizer_get_default_link_color()); $color_accent = get_theme_mod('plumr_accent_color', plumr_customizer_get_default_accent_color()); $css = ''; $css .= plumr_customizer_get_default_link_color() !== $color_link ? sprintf(' a:hover, a:focus, .entry-title a:hover, .entry-title a:focus, .js nav button:focus, .js .menu-toggle:focus { color: %1$s; } @media only screen and (max-width: 1280px) { .nav-primary li.highlight > a:hover, .nav-primary li.menu-item.highlight > a:focus { color: %1$s; } } ', $color_link) : ''; $css .= plumr_customizer_get_default_accent_color() !== $color_accent ? sprintf(' button:hover, button:focus, input:hover[type="button"], input:focus[type="button"], input:hover[type="reset"], input:focus[type="reset"], input:hover[type="submit"], input:focus[type="submit"], .button:hover, .button:focus, .content .widget .textwidget a.button:hover, .content .widget .textwidget a.button:focus, .entry-content a.button:hover, .entry-content a.button:focus, .entry-content a.more-link:hover, .entry-content a.more-link:focus, .footer-widgets, .nav-primary li.highlight > a:hover, .nav-primary li.highlight > a:focus { background-color: %1$s; } button:hover, button:focus, input:hover[type="button"], input:focus[type="button"], input:hover[type="reset"], input:focus[type="reset"], input:hover[type="submit"], input:focus[type="submit"], .button:hover, .button:focus, .content .widget .textwidget a.button:hover, .content .widget .textwidget a.button:focus, .entry-content a.button:hover, .entry-content a.button:focus, .entry-content a.more-link:hover, .entry-content a.more-link:focus, .nav-primary li.highlight > a:hover, .nav-primary li.highlight > a:focus { border-color: %1$s; } ', $color_accent) : ''; if ($css) { wp_add_inline_style($handle, $css); } }