[Resolved] Fonts in TinyMCE

Home Forums Support [Resolved] Fonts in TinyMCE

Home Forums Support Fonts in TinyMCE

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #377154
    Tom
    Lead Developer
    Lead Developer

    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.

    #377748
    Luis

    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.

    #377762
    Luis

    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

    #377882
    Tom
    Lead Developer
    Lead Developer

    Can you show me your full function?

    #378208
    Luis

    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.

    #378371
    Tom
    Lead Developer
    Lead Developer

    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' );
    #378686
    Luis

    OK, yeah, that works.
    Many thanks Tom. A pleasure.

    #378946
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.