Remove unwanted fonts from dropdown list
-
Please check the image in this link http://postimg.org/image/46yt15y53/
I want to remove font from that drop down list.
-
am using apprise child theme
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');
where should 1 paste this code ? function.php ?
Yes, in your child themes functions.php file.
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.
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 ?
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.Hi i changed as per your advice but still i can see the fonts.
check this http://postimg.org/image/xg0yukslj/
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?
Book Antigua – Courier New – Impact – Symbol – Terminal
Helvetica – Tahoma – Trebuchet MS – Webdings – WingdingsI want to remove above fonts
i removed some fonts and checked.. still its shows in list.. 🙁
And you have the child theme activated on your website?
Go to appearance -> themes.
Is the child theme the one that shows as active?
child theme is in active
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.
- The topic ‘Remove unwanted fonts from dropdown list’ is closed to new replies.