juillet 25, 2024 - Bloc 3

Derniers cours : juillet 25, 2024

Les cours sont classés par ordre où ils ont été donnés, du plus récent au plus ancien.

How do you add custom color swatches to all WYSIWYG editors?

How do you add custom color swatches to all WYSIWYG editors?

				
					function my_mce4_options($init) {

    $custom_colours = '
        "8D9C35", "vert",
        "812437", "bordeau",
        "EF9CAC", "Rose",
		"E5262A", "rouge",
		"382848", "noir-mauve",
		"FC6050", "orange"
		

    ';

    // build colour grid default+custom colors
    $init['textcolor_map'] = '['.$custom_colours.']';

    // change the number of rows in the grid if the number of colors changes
    // 8 swatches per row
    $init['textcolor_rows'] = 1;

    return $init;
}
add_filter('tiny_mce_before_init', 'my_mce4_options');