Skip to content

Instantly share code, notes, and snippets.

@beingtree
Last active October 14, 2017 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beingtree/798fe6338add610731ccb3fee0a699e3 to your computer and use it in GitHub Desktop.
Save beingtree/798fe6338add610731ccb3fee0a699e3 to your computer and use it in GitHub Desktop.
Wordpress Custom Text Color Picker
<?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