/** * Set up the WordPress core custom header and custom background features. * * @uses twentysixteen_header_style() */ function twentysixteen_custom_header_and_background() { $color_scheme = twentysixteen_get_color_scheme(); $default_background_color = trim($color_scheme[0], '#'); $default_text_color = trim($color_scheme[3], '#'); /** * Filter Twenty Sixteen custom-background support argument. * * @since Twenty Sixteen 1.0 * * @param array $args { * An array of custom-background support arguments. * * @type string $default-color Default color of the background. * } */ add_theme_support('custom-background', apply_filters('twentysixteen_custom_background_args', array('default-color' => $default_background_color))); /** * Filter Twenty Sixteen custom-header support arguments. * * @since Twenty Sixteen 1.0 * * @param array $args { * An array of custom-header support arguments. * * @type string $default-text-color Default color of the header text. * @type int $width Width in pixels of the custom header image. Default 1200. * @type int $height Height in pixels of the custom header image. Default 280. * @type bool $flex-height Whether to allow flexible-height header images. Default true. * @type string $wp-head-callback Callback function used to styles the header image and text * displayed on the blog. * } */ add_theme_support('custom-header', apply_filters('twentysixteen_custom_header_args', array('default-text-color' => $default_text_color, 'width' => 1200, 'height' => 280, 'flex-height' => true, 'wp-head-callback' => 'twentysixteen_header_style'))); }
/** * Enqueues front-end CSS for the secondary text color. * * @since www.ziedbouhejba.com 1.0 * * @see wp_add_inline_style() */ function twentysixteen_secondary_text_color_css() { $color_scheme = twentysixteen_get_color_scheme(); $default_color = $color_scheme[4]; $secondary_text_color = get_theme_mod('secondary_text_color', $default_color); // Don't do anything if the current color is the default. if ($secondary_text_color === $default_color) { return; } $css = ' /* Custom Secondary Text Color */ /** * IE8 and earlier will drop any block with CSS3 selectors. * Do not combine these styles with the next block. */ body:not(.search-results) .entry-summary { color: %1$s; } blockquote, .post-password-form label, a:hover, a:focus, a:active, .post-navigation .meta-nav, .image-navigation, .comment-navigation, .widget_recent_entries .post-date, .widget_rss .rss-date, .widget_rss cite, .site-description, .author-bio, .entry-footer, .entry-footer a, .sticky-post, .taxonomy-description, .entry-caption, .comment-metadata, .pingback .edit-link, .comment-metadata a, .pingback .comment-edit-link, .comment-form label, .comment-notes, .comment-awaiting-moderation, .logged-in-as, .form-allowed-tags, .site-info, .site-info a, .wp-caption .wp-caption-text, .gallery-caption, .widecolumn label, .widecolumn .mu_register label { color: %1$s; } .widget_calendar tbody a:hover, .widget_calendar tbody a:focus { background-color: %1$s; } '; wp_add_inline_style('twentysixteen-style', sprintf($css, $secondary_text_color)); }
function AfterSetupTheme() { load_theme_textdomain('twentysixteenchild', get_stylesheet_uri() . '/languages'); $color_scheme = twentysixteen_get_color_scheme(); // can be override by calling new function $default_background_color = trim($color_scheme[0], '#'); $default_text_color = trim($color_scheme[3], '#'); add_theme_support('custom-background', apply_filters('twentysixteen_custom_background_args', array('default-color' => $default_background_color))); $GLOBALS['content_width'] = 840; //change to override parent value add_theme_support('custom-header', apply_filters('twentysixteen_custom_header_args', array('default-text-color' => $default_text_color, 'width' => 1326, 'height' => 280, 'flex-height' => true, 'wp-head-callback' => 'twentysixteen_header_style'))); }
function twentysixteen_child_page_background_color_css() { $color_scheme = twentysixteen_get_color_scheme(); $default_color = $color_scheme[1]; $page_background_color = get_theme_mod('page_background_color', $default_color); // Don't do anything if the current color is the default. if ($page_background_color === $default_color) { return; } $css = ' /* Custom Page Background Color */ .site-inner { background-color: %1$s; } mark, ins, button, button[disabled]:hover, button[disabled]:focus, input[type="button"], input[type="button"][disabled]:hover, input[type="button"][disabled]:focus, input[type="reset"], input[type="reset"][disabled]:hover, input[type="reset"][disabled]:focus, input[type="submit"], input[type="submit"][disabled]:hover, input[type="submit"][disabled]:focus, .menu-toggle.toggled-on, .menu-toggle.toggled-on:hover, .menu-toggle.toggled-on:focus, .pagination .prev, .pagination .next, .pagination .prev:hover, .pagination .prev:focus, .pagination .next:hover, .pagination .next:focus, .pagination .nav-links:before, .pagination .nav-links:after, .widget_calendar tbody a, .widget_calendar tbody a:hover, .widget_calendar tbody a:focus, .page-links a, .page-links a:hover, .page-links a:focus { color: %1$s; } @media screen and (min-width: 56.875em) { .main-navigation ul ul li { background-color: %1$s; } .main-navigation ul ul:after { border-top-color: %1$s; border-bottom-color: %1$s; } } '; wp_add_inline_style('twentysixteen-child-style', sprintf($css, $page_background_color)); }