Site logo

Archived topic

Font Awesome link stripped out

3 replies · Started by Michael Andersen on November 30, 2015

Viewing posts 1–4 of 4

Hi,

GeneratePress theme should be ready for using Font Awesome, but when I insert fx <i class="fa fa-camera-retro"></i> it is stripped off when I save.
I'm using Advanced TinyMCE editor.

Hi there,

This is a WP editor/Advanced TinyMCE editor issue.

One solution is to place an HTML comment inside the icon:

<i class="fa fa-camera-retro"><!-- icon --></i>

Hi Tom

Thanks. It works. Nice little feature.

I kept searching and find also some other ways to deal with this problem. You can install the Advanced TinyMCE Config plugin. There you can set the option "extended_valid_elements" to "i[*]" (you add the i-tag to other "valid_elements"). That way the i-tag wont be stripped out.

Alternatively, in your functions.php you can add the following code:


function override_mce_options($initArray) {
   $opts = 'i[*]';
/*   $initArray['valid_elements'] = $opts; */ /*only if you want to change all valid_elemnts */
   $initArray['extended_valid_elements'] = $opts;
   return $initArray;
 }
   add_filter('tiny_mce_before_init', 'override_mce_options');

Btw, thank you for a very adaptive and well functioning theme, and your add-ons are great.

/Michael

Very cool - thanks for the other solutions! :)

This archived topic is closed to new replies.