Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
what happens when you wrap the text inside inline elements?
Then it breaks it even more, surprisingly. If I make this:
<p>text text text text <div style="display: inline;">SOME-CONTENT</div> text text text text</p>
…it becomes like this:
text text text text
SOME-CONTENT
text text text text
So not only the text is cut before the div but also after the rest of the text goes to the next line.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Sorry I meant this:
<p><div style="inline-block">text text text text</div> <div style="display: inline-block;">SOME-CONTENT</div> <div style="inline-block">text text text text</div></p>
But if it breaks even with inline styles then CSS is probably being applied elsewhere in the page
That would be more tricky to make, since the div is created by a shortcode. Shortcode is in a post/page text and User is adding it in the WP-text editor. For example:
text text text text [my-shortcode] text text
I could of course think of making the whole text chapter out of shortcode but that would be bit messy. Like this:
[my-shortcode before=”text text text text” after=”text text”]
Plus, in that case there could be only one shortcode in each chapter.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
You must have some styles being applied elsewhere, because your markup works: http://www.cssdesk.com/pgbjb
This is bit embarrassing.. I just found out that it was not the css at all. It is that WP is filtering the content and making changes to the html code. I don’t know how I didn’t notice it though I went through the code several times!! Sorry for that!
So when I write this in the editor
text text [my-shortcode] text text
..WP (+ my code for the shortcode) is supposed to output html code like this
<p>text text <div style="display: inline-block">
SOME CONTENT</div> text text</p>
..but instead WP outputs html like this !!
<p>text text</p>
<div style="display:inline-block">SOME CONTENT</div> text text
<p></p>
Not the first time getting trouble with the WP’s automatic “correction”. Mostly it, of course, makes good things, which is to correct human mistakes. But in this case it creates mistakes.
How to go around this automatic “corrections”?
THIS IS REALLY QUITE ANNOYING! I do LOVE WordPress, but not every single bit of it.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
is your shortcode coming from a plugin?
I’m building a custom theme and the shortcode is in a file the theme loads in its header. I guess practically it’s the same. If it would be in a plugin, it would be also loaded in the header, isn’t it?
Thank you so much Andrew for your patience and help! It’s really such a wonderful thing to have your developer mates helping over personally. Really appreciate! Keep going, good job!
I’ll start another support topic about this since this one is getting too long and not very helpful for others to follow. Problem is still unsolved.
Here is the new support request on the same topic:
https://ww.wp.xz.cn/support/topic/how-to-override-the-automatic-corrections-wp-makes-to-html?replies=1#post-7628283
If I could, I would just remove this fully. Not very useful to read to anyone. Moderators, please, remove this whole support request!