Viewing 15 replies - 1 through 15 (of 25 total)
  • Thread Starter vijiparthi

    (@vijiparthi)

    am using apprise child theme

    Plugin Author Josh

    (@josh401)

    Hi,

    As long as you are using a child theme; then we can place a function in there. The idea is we have to make a new list of fonts; removing the ones we don’t want to keep. There isn’t a way to just remove one… instead; we re-write the list to include all but the ones we don’t want.

    Here is the function:

    function remove_unwanted_fonts_from_dropdown($init) {
    
        // First, we must define a list of the default fonts
        // This is where you want to remove the fonts you don't want
        // Make sure to delete everything between the semi-colons
    
        $default_fonts = isset($init['font_formats']) ? $init['font_formats'] : '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;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
    
        // Now we add our new fonts back to the $init variable
        $init['font_formats'] = $default_fonts ;
    
        // Be sure to return the $init variable
        return $init;
    }
    add_filter('tiny_mce_before_init', 'remove_unwanted_fonts_from_dropdown');

    Thread Starter vijiparthi

    (@vijiparthi)

    where should 1 paste this code ? function.php ?

    Plugin Author Josh

    (@josh401)

    Yes, in your child themes functions.php file.

    Thread Starter vijiparthi

    (@vijiparthi)

    its not working.. i added the coding in to funtions.php under my child themes.. but stil i can see the fonts listed in dropdown box.

    Thread Starter vijiparthi

    (@vijiparthi)

    I just copied and past into function.php.. sorry i am new to coding.. do i need to add or remove anything on this code ?

    Plugin Author Josh

    (@josh401)

    If you don’t already have the opening <?php tag.. you’ll want to add that as well.

    If you have nothing in your functions.php file… then it should look like this:

    <?php
    function remove_unwanted_fonts_from_dropdown($init) {
    
        // First, we must define a list of the default fonts
        // This is where you want to remove the fonts you don't want
        // Make sure to delete everything between the semi-colons
    
        $default_fonts = isset($init['font_formats']) ? $init['font_formats'] : '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;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
    
        // Now we add our new fonts back to the $init variable
        $init['font_formats'] = $default_fonts ;
    
        // Be sure to return the $init variable
        return $init;
    }
    add_filter('tiny_mce_before_init', 'remove_unwanted_fonts_from_dropdown');

    Note the opening <?php tag.

    Thread Starter vijiparthi

    (@vijiparthi)

    Hi i changed as per your advice but still i can see the fonts.

    check this http://postimg.org/image/xg0yukslj/

    http://postimg.org/image/5h2q2nrld/

    Plugin Author Josh

    (@josh401)

    Did you remove the fonts from the code as I instructed above?

    I didn’t know which ones you wanted to remove… so I made the entire list of default fonts.

    You need to remove the ones from the code that you don’t want showing in the dropdown list.

    Tell you what… which fonts are you wanting to remove?

    Thread Starter vijiparthi

    (@vijiparthi)

    Book Antigua – Courier New – Impact – Symbol – Terminal
    Helvetica – Tahoma – Trebuchet MS – Webdings – Wingdings

    I want to remove above fonts

    Thread Starter vijiparthi

    (@vijiparthi)

    i removed some fonts and checked.. still its shows in list.. 🙁

    Plugin Author Josh

    (@josh401)

    And you have the child theme activated on your website?

    Go to appearance -> themes.

    Is the child theme the one that shows as active?

    Thread Starter vijiparthi

    (@vijiparthi)

    Thread Starter vijiparthi

    (@vijiparthi)

    child theme is in active

    Plugin Author Josh

    (@josh401)

    Are you using a browser cache plugin? If so, delete that cache from the plugin admin page.

    Also, manually clear and refresh your browser cache.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Remove unwanted fonts from dropdown list’ is closed to new replies.