Archived topic
Fonts in TinyMCE
22 replies · Started by Luis on August 25, 2017
By leaving the window blank, you mean there's just a white screen on every page of your website? Can't access anything?
Are there any visible errors? If not, check the error_log file on your server.
For leaving the window blank, I mean that in TinyMCE, and only in it, do not appear the menus of the header (those that allow you to select font, indent, etc), nor does the text appear within the editing zone.
The rest of Wordpress works fine, and the web looks good. It's just TinyMCE when editing a page.
There are no errors in error_log file.
Thank you and forgive me for being so heavy.
I think I've broken it. :-)
The function:
wp_parse_args (
get_option ('generate_settings', array ()),
generate_get_default_fonts ()
);
is returning 'Open Sans' simply, and TinyMCE needs 'Open Sans = Open Sans, sans-serif'.
O sea, TinyMCE needs the "CSS font-family Property", with the different families separated by ;
Thank
Can you show me your full function?
This works:
function my_mce_settings_font ( $settings ) {
$font_formats= 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n';
$settings['font_formats'] = $font_formats;
return $settings;
};
add_filter('tiny_mce_before_init', 'my_mce_settings_font');
This does not work:
function my_mce_settings_font( $settings ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_default_fonts()
);
$settings['font_formats'] = $generate_settings['font_body'];
return $settings;
}
add_filter( 'tiny_mce_before_init' , 'my_mce_settings_font' );
And that's the whole function.
As I said, I think the problem is that TinyMCE needs the “CSS font-family Property”, with the different families separated by ;
Thank.
You could try this then:
function my_mce_settings_font( $settings ) {
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_default_fonts()
);
$settings['font_formats'] = $generate_settings['font_body'] . '=' . $generate_settings['font_body'];
return $settings;
}
add_filter( 'tiny_mce_before_init' , 'my_mce_settings_font' );
OK, yeah, that works.
Many thanks Tom. A pleasure.
You're welcome :)