Okay
  Public Ticket #296596
Span, i and other tags stripping
Closed

Comments

  • Alexandre started the conversation

    Hello,

    I know this is a problem with Wordpress and TinyMCE cleaning the HTML code and striping the span, i tag, empty div tags, etc when you change from visual editor to text. But I needed to use the i tag to implement my custom icon font and still take advantage of the CSS formating without having to rewrite the shortcode part.

    So I was modifying my function.php and adding the following :

    function change_mce_options($initArray) {

    $ext = 'pre[id|name|class|style],div[*],span[*],i[*], iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]';

    if (isset($initArray['extended_valid_elements'])) {

    $initArray['extended_valid_elements'] .= ',' . $ext;

    } else {

    $initArray['extended_valid_elements'] = $ext;

    }

    return $initArray;

    }

    add_filter('tiny_mce_before_init', 'change_mce_options'); 

    First of all it seems to work without any problem. I would like to know if this might break other functionalities in the theme ?

    If not then I think it's a good thing to share this little trick with others.

    Best,

    Alex

  •  1,071
    ThemeNectar replied

    Hey Alex! I can't see how that would break anything off the top of my head, but please let me know if you've encountered any issues :)

  • Alexandre replied

    Hi,

    ok thank you for your answer, I have not noticed something strange yet and I've been playing with the theme quite a bit.

    Best,

    Alex