• Hi!

    I would like to show a div element inside the text just as if div was a single word. This should be very easy by using following

    <p>text text text text <div style="display: inline-block;">SOME-CONTENT</div> text text text text text text text text text text text text text text text text text</p>

    However, there is something in WordPress that breaks it. Shows like this:

    text text text text

    SOME-CONTENT text text text text text text text text text text text text text text text text text text text text text text text

    So how to make wordpress NOT brake the text before my div?? I tried also span element, but WordPress brakes it even more.

    The div is created by a shortcode, so there should not be that much filters done for it as there is for normal content, but something still is made and that spoils my plans..

Viewing 9 replies - 1 through 9 (of 9 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    what happens when you wrap the text inside inline elements?

    Thread Starter janneval

    (@janneval)

    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

    Thread Starter janneval

    (@janneval)

    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: https://www.cssdesk.com/pgbjb

    Thread Starter janneval

    (@janneval)

    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?

    Thread Starter janneval

    (@janneval)

    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?

    Thread Starter janneval

    (@janneval)

    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://www.ads-software.com/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!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘inline-block css property not working!’ is closed to new replies.