- This topic has 5 replies, 2 voices, and was last updated 8 years, 1 month ago by Tom.
-
AuthorPosts
-
February 8, 2016 at 11:03 am #171367Tony
I’m not sure if it works for all code but I have found that using
around the code stops the WP visual editor stripping code e.g.
to force a ‘line break’<div style="padding: 10px;"></div>
Tony
February 8, 2016 at 11:55 pm #171453TomLead DeveloperLead DeveloperIf I’m going to add an empty HTML tag in the editor I just add an HTML comment inside of it:
<div style="padding:10px;"><!-- HTML comment --></div>
That will also stop WP from stripping it 🙂
February 9, 2016 at 12:30 am #171464TonyI’m not sure what you mean. I wanted to force a line break and if you use <br> it is stripped out even inside
the same applies to <p>
I am finding getting spacing between lines a pain in the rear so landed on using the<div style="padding: 10px;"></div>
.When you use return or space/return to insert line spaces you can never tell how they’ll be used or what WP will put into the page it seems to me.
Seems some code is OK and some not but there’s no list of what works and what doesn’t.
Using the two image idea to have a small image in the excerpt I had to make a gallery the ‘full-image’ and again wrapped it in a
.I’d use the text editor all the time but a) I’m not much on htmal because I always used WYSIWYG Dereamweaver so I just experiment to see what works b) the visual editor makes inserting media so easy.
Wild West!
February 9, 2016 at 11:08 am #171601TomLead DeveloperLead DeveloperThe editor shouldn’t actually strip
<br />
tags at all – they’re pretty important.While using the “Visual” tab, hold Shift + Enter to create a one line break (not a paragraph).
<p>
tags and<br />
tags won’t show in the “Text” tab, but if there’s an empty line between paragraphs WP will create the paragraph, and if there’s one line break between lines it will create the<br />
tag.February 9, 2016 at 11:56 am #171623TonyThe editor shouldn’t actually strip <br /> tags at all – they’re pretty important.
Yes, but it does.
I don’t find the WP editors are consistant.
I agree with what you say and understand the shift+enter etc. but, as an example, I wanted a gap between an inserted image and the first line of text under it.
No matter what combination of enter I used it would change when I opened the page in visual editor.
I think the way it is interpreted is dependant on unknown parameters but using the
<div style="padding: 10px;"></div>
works every time.So far as I can tell the editor has been complained about for years – it’s more like a mark-down editor than mark-up but doesn’t behave like one.
February 9, 2016 at 8:43 pm #171700TomLead DeveloperLead DeveloperIt’s definitely not perfect – always being improved though.
If you have an example of an image needing space below it I may be able to help.
-
AuthorPosts
- You must be logged in to reply to this topic.