Home>Support>Problem with custom colors in tinymce editor

Problem with custom colors in tinymce editor

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hi,

I used in function.php a code to custom default colors in editor. It’s work perfectly with standard wordpress editor but with Siteorigin editor, the colors are not display. After personal investigation, I find the problem in the variable type used for $init[‘textcolor_map’]. WordPress want a string and Siteorigin want an array.
So, have you a solution which work for WordPress and SiteOrigin Editors ?

Work with standard wordpress editor not Siteorigin editor:
function maxitabs_mce4_options($init) {
$default_colours = ‘”000000″, “Black”,
“993300”, “Burnt orange”,
“333300”, “Dark olive”,
“003300”, “Dark green”‘;
$init[‘textcolor_map’] = ‘[‘.$default_colours.’]’;
$init[‘textcolor_rows’] = 6;
$init[‘textcolor_cols’] = 8;
return $init;
}
add_filter(‘tiny_mce_before_init’, ‘maxitabs_mce4_options’);

Work with Siteorigin editor not with standard wordpress editor:
function maxitabs_mce4_options($init) {
$default_colours = array(“000000”, “Black”,
“993300”, “Burnt orange”,
“333300”, “Dark olive”,
“003300”, “Dark green”);
$init[‘textcolor_map’] = $default_colours;
$init[‘textcolor_rows’] = 6;
$init[‘textcolor_cols’] = 8;
return $init;
}
add_filter(‘tiny_mce_before_init’, ‘maxitabs_mce4_options’);

Thank you

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 10 months ago Alex S
    Hi, I Work Here

    Hi Mike,

    I’m going to bring this up with the development team – sorry about this.

  2. 7 years, 10 months ago Alex S
    Hi, I Work Here

    Hi Mike,

    Please try:

    function so_custom_palette( $init ){
    	$custom_colours = ' "000000", "Black", "993300", "Burnt orange", "333300", "Dark olive", "003300", "Dark green"';
    	$init['textcolor_map'] = '['.$custom_colours.']';
    	return $init;
    }
    add_filter( 'tiny_mce_before_init','so_custom_palette' );
    
  3. 7 years, 10 months ago mike31

    Hi Alex,

    Well I try your code and it’s work ! But if I want add more rows (to add more colors) with

    $init['textcolor_rows'] = 6

    Siteorigin Builder does not show any colors (but WordPress yes).
    After personal investigation, I founded the solution with Siteorigin Builder it’s necessary to put the code

    $init['textcolor_rows']

    before

    $init['textcolor_map'] = '['.$custom_colours.']';

    So now with your help (and dev team) it’s work !! thank you

    Michael

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More