Last night I created a small Infographic and posted it to one of my posts.
Then I tried to put an embed code so that people can easily copy it. However the double-quotes in the outcome seems to be different, which makes the embed code useless.
This is the code I used to generate the embed code.
<textarea style="width: 600px; height: 120px; padding: 10px;" onclick="this.select();" cols="70" rows="5"><p style="text-align: left;"><a href="http://beginwebsites.com/significance-of-seo-pyramid/"><img class="aligncenter size-full wp-image-3375? title="The SEO Pyramid" alt="The SEO Pyramid" src="http://beginwebsites.com/wp-content/uploads/2012/11/The-SEO-Pyramid.jpg" width="750? height="889? /></a><small>Like this infographic? Get more <a title="SEO Basics: From Novice to Nerd" href="http://beginwebsites.com/seo-basics-from-novice-to-nerd/">SEO tips</a> from <a title="BeginWebsites home" href="http://beginwebsites.com/">Begin Websites</a>.</small></p></textarea></p>
Why is the double-quotes (“) displaying differently? Can you help?
Did you by any chance insert it using the visual view of the post editor instead of the text view? I got similar results using visual view, but it worked properly in text view.
The post editor does weird things to code, even in text view. Probably the best way to protect code from the editor is to pass the contents to a shortcode and let the shortcode output the code.
BTW, there’s some syntax errors at the size parameters for The-SEO-Pyramid.jpg
bcworkz, thank you for youe response.
Actually the code you see above is not the real code I used. Somehow I can’t get it to display correctly on this forum. So I’ve put it on a PDF on google docs for reference. Here’s the link,
Did you notice a ” (yellow) character instead of ” (green) in the outcome. Why is this happening? How do I resolve it?
As bcworkz asked, did you insert that textarea with the embed code using the Visual or Text editor? When I took the code from your site and plopped it into Text, it added double quotes.
A) The Visual editor is converting your double quotes
B) Whatever you copy/pasted from was using “smart quotes” (Word is typically the culprit, but other programs do it, too)
Try writing out the embed code in Notepad, then copying it into your post from the Text editor.
This is what I did;
I opened up a new post, and in the visual editor I inserted the infographic, inserted the necessary texts and graphics and previewed it to make sure that the outcome was what I wanted.
Then I switched to the text editor, copied the code, went to my usual HTML encoder (http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx),
pasted the code in to it and got it HTML encoded.
Finally I copied the HTML encoded code, went to my post in concern and in the editor I clicked on the text tab (text editor), and pasted the code between <textarea style=”width: 600px; height: 120px; padding: 10px;” onclick=”this.select();” cols=”70″ rows=”5″>…</textarea>
Did I do something wrong here?
I’m going to venture a guess that the HTML encoding portion was what did it. I don’t know though.
I’d just copy the code <i>exactly</i> as it appears in your post (in the text editor) and place that within a textarea. Anything within a textarea will [should] be treated as plain text. See if that works, then go from there with customizing.
Wow Rebecca! That was excellent!
I pasted the exact code between textarea like you said and it solved my issue. Thank you very much. Really appreciate it.
- The topic ‘Problem with embed code’ is closed to new replies.