1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Line breaks </ br> changing to <!-- br--> when switching between HTML and Visual tab

Discussion in 'Blogging' started by BlackxHat, May 27, 2012.

  1. BlackxHat

    BlackxHat Power Member

    Joined:
    Oct 6, 2009
    Messages:
    591
    Likes Received:
    78
    I'm a code newbie and I was just making a wordpress post and instead of using the correct line break code of <br /> I used </ br>. When I switched to the visual editor and back to the HTML editor, to my surprise the line break code was still there. But it had changed from </ br> to <!-- br-->

    Should I just use that <!-- br--> code now instead of </ br> or </ br>? If it's okay, I would like to because I like switching between visual and html tabs. This allows me to do that with the line break code to disappear. So should i use that <!-- br-->? I just dont want it to break my theme later on if i'm using the wrong code
     
    Last edited: May 27, 2012
  2. Abstroose

    Abstroose Elite Member

    Joined:
    Nov 20, 2008
    Messages:
    2,097
    Likes Received:
    3,483
    Occupation:
    Thai Boxer
    Location:
    UK
    Home Page:
    Why did you use </br> instead of <br/>?

    <!-- --> is code for comments. Is it still creating a line break when you publish the post?
     
  3. BlackxHat

    BlackxHat Power Member

    Joined:
    Oct 6, 2009
    Messages:
    591
    Likes Received:
    78
    I used it by mistake, i thought it was the same as <br/> but apparently it isn't. The thing is that when you use <br/> and switch between tabs, the code disappears. But if you use </br> and switch tabs, it doesnt disappear, it changes to <!-- br-->. And yes <!-- br--> does still produce line breaks apparently.

    So i dont know. I like switch between tabs when posting, so if possible can I use that <!-- br--> instead? i just dont want it to break my theme or something by using the wrong code
     
  4. Ginger_Ale

    Ginger_Ale Registered Member

    Joined:
    Feb 5, 2012
    Messages:
    66
    Likes Received:
    37
    Location:
    Argentina
    I hate the WP default editor... I installed a plugin called Markdown (you have to install it and then go to Users > My Profile and check "Disable the visual editor when writing"... Then you just write and it automatically creates the code... for me it's much easier...
     
  5. Abstroose

    Abstroose Elite Member

    Joined:
    Nov 20, 2008
    Messages:
    2,097
    Likes Received:
    3,483
    Occupation:
    Thai Boxer
    Location:
    UK
    Home Page:
    Publish a post using <!-- br -->, then view the published post, right-click and view source. Go the point in your HTML where the line break is and see which code is displayed (whether it is <!-- br --> or has been converted to <br/>).
     
    • Thanks Thanks x 1
  6. BlackxHat

    BlackxHat Power Member

    Joined:
    Oct 6, 2009
    Messages:
    591
    Likes Received:
    78
    It says

    Code:
    <p><!-- br--><br /> <!-- br--><br /> <!-- br--><br /> <!-- br--><br /> <!-- br--><br /> <!-- br--><br /> <!-- br--><br /> <!-- br--><br /> <!-- br--></p> <p>my text, text, text</p>
    hmm do you think I can leave it like that?
     
  7. Abstroose

    Abstroose Elite Member

    Joined:
    Nov 20, 2008
    Messages:
    2,097
    Likes Received:
    3,483
    Occupation:
    Thai Boxer
    Location:
    UK
    Home Page:
    That's creating a lot of messy code. Although I doubt it will break your theme, it's adding a lot of unnecessary code and ultimately increasing your code to text ratio, which should be kept low as possible for SEO. If you can, just use <br/> in the future.
     
    • Thanks Thanks x 1
  8. blackberry

    blackberry Power Member

    Joined:
    Apr 26, 2009
    Messages:
    675
    Likes Received:
    218
    Occupation:
    Making money
    Location:
    Planet Earth
    Why would you want something so messy like that?


     
  9. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    664
    Occupation:
    WordPress developer
    Home Page:
  10. BlackxHat

    BlackxHat Power Member

    Joined:
    Oct 6, 2009
    Messages:
    591
    Likes Received:
    78
    Well the only thing i see in the html editor is this:

    <!-- br-->
    <!-- br-->
    <!-- br-->

    the rest of the stuff only shows up in the source code
     
  11. blackberry

    blackberry Power Member

    Joined:
    Apr 26, 2009
    Messages:
    675
    Likes Received:
    218
    Occupation:
    Making money
    Location:
    Planet Earth
    I have seen this happen if someone enables a different editor like Deans FCK Editor or Super Edit.

    If you have a different default editor enabled as a plugin you might see this issue.
    Disable the plugin and your issue should go away.

    If you havent changed the default editor of wordpress, then install a plugin like the above, and maybe that will fix it.
    If it doesent...well you can always disable it.

    Try that and see how it goes.