Last active
October 14, 2017 20:06
-
-
Save beingtree/798fe6338add610731ccb3fee0a699e3 to your computer and use it in GitHub Desktop.
Wordpress Custom Text Color Picker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* .... some other theme functions ... */ | |
/* Custom Default Text Colors for WP TinyMCE Editor */ | |
function theme_name_text_colors( $init ) { | |
$default_colors = ' | |
"000000", "Black", | |
"FFFFFF", "White" | |
'; | |
$custom_colors = ' | |
"bdd54a", "Green", | |
"b0dfe4", "Blue", | |
"f192bc", "Pink" | |
'; | |
$init['textcolor_map'] = '['.$default_colors.','.$custom_colors.']'; | |
$init['textcolor_rows'] = 1; | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'theme_name_text_colors'); | |
add_filter('tiny_mce_before_init', 'theme_name_text_colors'); | |
/* .... possibly more theme functions ... */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment