Support » Fixing WordPress » editor filtering code

  • Hi!
    In all of my WP installs, 2 of them the latest 2.12, the wysiwyg editor messes up the div tags I insert in code view and changes them to p tags. It just adds a paragraph tag and a no breking space in between them. What is this? I’m a programmer and all that, but want to use the wysiwyg editor anyway. Is there an easy way to get into the regexp filtering of the editor?

    Here’s what i want to do with the wysiwyg editor on, but in html mode:

    <div class="column">
    first column
    </div>
    <div class="column">
    second column
    </div>

    It turns into something like this after I save and open it again:

    <p class="column">&nbsp;</p>
    first column
    <p class="column">&nbsp;</p>
    second column

    As you can see, this gets serious from a layout point of view. It happens if I open a previous post which is correct and validated.
    I’ve tried to dig into the TinyMCE files, but couldn’t find what I was looking for (yet)
    I’ve also tried posting questions about this here and there. Any hints anyone? (except “turn the wysiwyg editor off”)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here’s what i want to do with the wysiwyg editor on, but in html mode:
    <div class=”column”>
    first column
    </div>
    <div class=”column”>
    second column
    </div>

    You do realize that this code is invalid markup, right? Div is a block level element which can only contain other block level elements. Straight text is an inline element. You could do something like <div><p>text</p></div> and that would be valid, since P is a block level element which can only contain inline elements.

    I admit that the editor is annoying, but when you feed it bad markup and it tries to fix it, it’s probably going to do it badly.

    Otto, I think somewhere along the way you’ve been misled. His code Is valid code. A Div tag may contain both block and inline elements.

    Tdude, the answer to your problem can be found at this post…

    http://wordpress.org/support/topic/102696?replies=4

    Never mind. Thanks Sauceyman! Otto too!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘editor filtering code’ is closed to new replies.