WordPress.org

Ready to get started?Download WordPress

Forums

[closed] HTML editor: returns affecting code... (17 posts)

  1. shawncbarry
    Member
    Posted 1 year ago #

    Before starting this topic, I did indeed search extensively under "hard returns", "HTML editor", problems, etc., but kept landing on topics where people were talking about paragraph returns in the visual editor etc. I gather this has likely been talked about already, so this is no doubt a repeat topic, but I'm "stuck in a loop" so to speak. Anyway...

    I'm creating a custom theme, as well as building out the content from my old static site into WP. so, I'm working with both PHP documents edited via Coda, and creating content pages within WP. When I'm writing HTML/CSS, I like to put a return between tags to organize my code (ex: I'll open a div tag and hit return to put the img tag on the next line to clean it up while writing code). In WP, I only use the HTML editor when I'm creating content within WP. When I write a tag, then hit return to write the next tag on the next line, it's changing the HTML code, and it no longer renders properly. I discovered this after losing my mind completely with floating left images that kept stepping down a line from one another. I thought I was going pass out from frustration, then realized it was the HTML editor in WP adding something extra to the code.

    Is it possible to disable WP's interference with the code within the HTML editor? I just want to be able to write code to look organized as I would in Code, or whatever.

    Help, and thinks.

  2. vtxyzzy
    Member
    Posted 1 year ago #

    I like CKEditor because it seems much more 'predictable' than TinyMCE (the WP editor). However, it does not work with a few other plugins, so I can't always use it.

    When I can't use CKEditor, I use the Ultimate TinyMCE plugin which adds lots of functionality to TinyMCE, including its own HTML editor.

  3. shawncbarry
    Member
    Posted 1 year ago #

    Thanks for the suggestions. Those look interesting if you prefer the visual editor. my issue isn't the editor interface, but rather that the code is being "altered" by the HTML editor in a way I can't see or control. Know what I mean?

    I may not have stated the problem properly - I need to know why WP HTML editor (not the visual editor) is adding extra code or affecting the code when I hit a hard return to break up the run-on code. Hope I'm making sense.

  4. vtxyzzy
    Member
    Posted 1 year ago #

    As I said, both of those plugins offer solutions. Each has its own HTML editor, so you don't need the TinyMCE HTML editor which messes with your code.

  5. shawncbarry
    Member
    Posted 1 year ago #

    Actually, yes, I did look again at the plugin links you mentioned and was just about to post to say "Oh, wait, I get it." but you beat me to it. I just downloaded CKEdit - I'll give that a shot.

    Thanks

  6. shawncbarry
    Member
    Posted 1 year ago #

    Still happens. Does that mean the code alteration's not coming from WP, I wonder? is this a php problem?

    Where I encounter the problem is like this:

    This works in WP HTML editor, and in external page code...

    <div>
         <a><img /><img/></a>
    </div>

    This does NOT work in WP HTML editor, but DOES work in external page code...

    <div>
         <a>
                <img />
                <img/>
         </a>
    </div>
  7. Pali Madra
    Member
    Posted 1 year ago #

    From my experience the HTML editor does not behave the way it is doing for you. Hard returns do not affect the code. Therefore I believe there is something more going on.

    Can you please let me know which plugins are activated in WordPress? It might be a case of clash with a plugin.

    Another option I would suggest is to use the html editor and just add text to it and use the HTML editor buttons to add the html tags if possible (though I know the buttons are for limited HTML tags).

  8. shawncbarry
    Member
    Posted 1 year ago #

    I use the following plugins:

  9. shawncbarry
    Member
    Posted 1 year ago #

  10. shawncbarry
    Member
    Posted 1 year ago #

    ...okay, no idea why the links didn't show up.

    I use VideoJS-pro, BAW Like/Unlike and Admin post Navigation.

  11. Pali Madra
    Member
    Posted 1 year ago #

    Please try deactivating the plugins and see if the problem persists.

  12. vtxyzzy
    Member
    Posted 1 year ago #

    I can't tell if you are still using the WP HTML mode or not. If you are, use the CKEdtor 'Source' mode or the Ultimate TinmMCE Advanced HTML Editor instead.

  13. shawncbarry
    Member
    Posted 1 year ago #

    vtxyzzy - I DID try the CKEdit. Same problem persisted.

    Palimadra - I turned them all off. Same problem.

  14. shawncbarry
    Member
    Posted 1 year ago #

    I also tried turning ALL OFF but leaving CKEdit ON, but that didn't work either.

  15. vtxyzzy
    Member
    Posted 1 year ago #

    Sorry, I'm out of suggestions.

  16. shawncbarry
    Member
    Posted 1 year ago #

    Okay, I'll just have to write code sentence-style, I suppose. Disconcerting that it's a problem no one else is having. Is it possible to have a corrupt version of WordPress?

  17. vtxyzzy
    Member
    Posted 1 year ago #

    Ultimate TinyMCE has an Advanced HTML editor that shows the HTML indented and color coded even though it may be stored in 'string' form.

    It also has an option to disable wpautop so that p and br tags are not removed from the code. However, that means that you must manually enter those tags in every post or page, including those already written. See the Help by clicking the Help icon next to the option.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.