bhammie85
Forum Replies Created
-
Ok that worked. Thank you!
Forum: Fixing WordPress
In reply to: Inline SVG Disappears When Switching Between Editing ModesI haven’t found any solution to permanently fix this, but I did turn off the Visual mode as a temporary fix by using this code in my functions.php file for the pages where I am using SVGs:
add_filter( 'user_can_richedit', 'disable_my_richedit' ); function disable_my_richedit( $default ) { global $post; if ( in_array( $post->ID, array(432, 10) ) ) // change the post ID return false; return $default; }I found the solution here.
My clients don’t mind that much but it would be nice to get Visual mode back at some point.
Thanks for your help!
Forum: Fixing WordPress
In reply to: Inline SVG Disappears When Switching Between Editing ModesHi Josh,
Any luck with a solution? Maybe TinyMCE doesn’t like <g> or <rect> or <circle> elements, or it doesn’t like self-closing elements?
Is there an alternative to TinyMCE that I could try?
Thanks!
Forum: Fixing WordPress
In reply to: Inline SVG Disappears When Switching Between Editing ModesHi Josh,
I placed your code in the bottom of my theme’s functions.php file. I created the theme using underscores.me.
I also copied just the snippet of the svg code (as in what I said in my first message) and tried that, and yes it worked.
However, the problem is that the actual svg is a really big complex graphic and has lots of elements inside of it – and WordPress doesn’t like something about it. It contains
<rect>s,<circle>s,<path>s,<g>s, etc.Here’s a screenshot of both the small snippet and the big one. You can see the big one still doesn’t work.
I did some testing by removing individual elements, but if I leave anything inside the
<svg>tags, WordPress removes the whole thing.Here’s a link to the raw svg code.
Any idea how to get WordPress to ignore everything inside the
<svg>tags?Forum: Fixing WordPress
In reply to: Inline SVG Disappears When Switching Between Editing ModesHi Josh,
Thanks for the quick response!
Unfortunately it didn’t work for me. I put it in the bottom of my functions.php file and I still get the same behavior. Here is a little gif screencast of the problem:
Any ideas? The “weird” attributes for
<svg>elements are standard attributes for them.