• I am using wordpress 3.9.1
    I want to add custom fonts in my wordpress site so that I can select my custom font from font list in editor body field.
    What I have done:
    I have added wave font in my stylesheets.

    @font-face {
    font-family: ‘devanagari_newnormal’;
    src: url(‘fonts/devnew-webfont.eot’);
    src: url(‘fonts/devnew-webfont.eot?#iefix’) format(’embedded-opentype’),
    url(‘fonts/devnew-webfont.woff’) format(‘woff’),
    url(‘fonts/devnew-webfont.ttf’) format(‘truetype’),
    url(‘fonts/devnew-webfont.svg#devanagari_newnormal’) format(‘svg’);
    font-weight: normal;
    font-style: normal;

    }

    In function.php i have define custom font.

    // Add custom Fonts to the Fonts list
    if ( ! function_exists( ‘wpex_mce_fonts_array’ ) ) {
    function wpex_mce_fonts_array( $initArray ) {
    $initArray[‘font_formats’] = ‘Devanagari=devanagari_newnormal;Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Wingdings=wingdings,zapf dingbats’;
    return $initArray;
    }
    }
    add_filter( ‘tiny_mce_before_init’, ‘wpex_mce_fonts_array’ );

    What the things happening here is:
    I am able to select font in body fields (ie. Devanagari in my case) of Tiny mce. But the font did’t changes as I have desired there.
    And when i see the post ie in single.php the post appears in selected font family (ie Devanagari).

    My question is: How to make the custom fonts appears in admin also so that on changing the fonts it appears as other default fonts appears in Tinymce editor?

    Any help are appreciate.

  • The topic ‘Adding custom fonts in Tinymce’ is closed to new replies.