Make WordPress Core

Changeset 39387 for branches/4.7


Ignore:
Timestamp:
11/30/2016 10:56:08 PM (8 years ago)
Author:
ocean90
Message:

Twenty Seventeen: Allow child themes to easily extend custom color patterns

By adding a filter, child themes can add additional selectors onto the custom color scheme CSS. Like so:

// Add child theme selectors for color schemes.
function dynamic_seventeen_custom_colors_css( $css, $hue, $saturation ) {
	$css .= '
	.colors-custom .content-menu > article:not(.has-post-thumbnail),
	.colors-custom .content-menu > section:not(.has-post-thumbnail) {
		border-top-color: hsl( ' . $hue . ', ' . $saturation . ', 87% ); /* base: #ddd; */
	}';
	return $css;
}
add_filter( 'twentyseventeen_custom_colors_css', 'dynamic_seventeen_custom_colors_css', 10, 3 );

Merge of [39386] to the 4.7 branch.

Props celloexpressions.
See #38949.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-content/themes/twentyseventeen/inc/color-patterns.php

    r39243 r39387  
    558558}';
    559559
    560     return $css;
    561 }
     560
     561    /**
     562     * Filters Twenty Seventeen custom colors CSS.
     563     *
     564     * @since Twenty Seventeen 1.0
     565     *
     566     * @param $css        string Base theme colors CSS.
     567     * @param $hue        int    The user's selected color hue.
     568     * @param $saturation string Filtered theme color saturation level.
     569     */
     570    return apply_filters( 'twentyseventeen_custom_colors_css', $css, $hue, $saturation );
     571}
Note: See TracChangeset for help on using the changeset viewer.