WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Keeping Line breaks - Is there a fix?!?!? (33 posts)

  1. nickb34
    Member
    Posted 7 years ago #

    Hey everyone, Ive got an install of WordPress and im trying to get it to keep <br> or
    tags in my posts. If i am posting an HTML story, or even typing the spaces in myself, they still get filtered out.

    I have looked at about 10 different threads, including:

    http://wordpress.org/support/topic/52958?replies=19

    I have tried countless plugins, changing Tiny MCE.js properties, and even tried changing some things in functions-formatting.php. No luck.

    How can you have spaces in your post??? What if you want 4 or 5 lines between something? If there is a fix I would greatly appriciate a post explaining how to do this.

    Thanks in advance.
    --Nick

  2. nickb34
    Member
    Posted 7 years ago #

    bump

  3. nickb34
    Member
    Posted 7 years ago #

    bump

  4. manstraw
    Member
    Posted 7 years ago #

    You've got the bumps, best see a doctor soon!

    Well, html really doesn't want you to do stuff like put blank lines between paragraphs and stuff. It really really wants you to do that in css nowadays.

    If you want custom html, just turn off the visual rich editor for a user, and edit the posts with that user. That combined with editing the html source when I post satisifies most of my needs (which mainly involve not letting wordpress bust the odd bit of javascript I put in). Is this not sufficient for your needs?

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Yeah, turn off the visual rich editor and you can put in whatever you like.

    Also, <br> is incorrect. That should be <br/>. XHTML, you know.

  6. nickb34
    Member
    Posted 7 years ago #

    Ive turned off the rich editor, AND tried putting
    tags, still no spacing at all.

    What is the problem here?

  7. manstraw
    Member
    Posted 7 years ago #

    Are you clicking the html button, and typing
    ? Then close it and save.

  8. nickb34
    Member
    Posted 7 years ago #

    Yep.

    Tried that with both the rich editor on and off. And with <br> and
    tags.

    Nothing works.

  9. manstraw
    Member
    Posted 7 years ago #

    I recommend you cruise the plugins for something that meets your needs. You could start here > http://codex.wordpress.org/Plugins/Posts_Editing

  10. nickb34
    Member
    Posted 7 years ago #

    Alright i will look into that,

    but i find it hard to believe that no one using WordPress anywhere is happy with absolutely no spaces?

    People have to be adding spaces somehow?

  11. LiverpoolLad
    Member
    Posted 7 years ago #

    You ought have a break if you just use the enter key when editing.
    If you look at the html for this post, there should be a break between the first line and second. And they will be contained in a paragraph, I think!

    This now ought to be a paragraph on its own.

    Update: Having looked at the html for this post, i'm correct, so WordPress does use <br /> if you use the enter key and start on a new line.

  12. nickb34
    Member
    Posted 7 years ago #

    Still filtering the
    's out.

    If you put 10
    tags after a paragraph, by hitting enter, or manually adding them in yourself, in the Rich editor or NOT, they still get filtered.

  13. nickb34
    Member
    Posted 7 years ago #

    Right there, it filtered out the break tag in my previous post, which again proves what im saying.

    What if you wanted to have 10 spaces, can you do it?

  14. manstraw
    Member
    Posted 7 years ago #

    I mentioned at the beginning of this thread that css is where this should actually be done anyway. html itself likes to not display extra space characters for example. we're supposed to separate style from content these days. css is where we can easily customize the space before a paragraph.

    are you open to doing it with css? I'd be happy to give you an example if you are.

  15. nickb34
    Member
    Posted 7 years ago #

    I dont really care what I use, but I want to be able to easily publish something with spaces, lets say, 10 if i wanted to without too much trouble.

  16. webhound
    Member
    Posted 7 years ago #

    I was having the same problem. Here's how you can use an inline style to add space:

    <p style="line-height: 15pt">

    Use whatever you want on the line-height property to suit your needs:

    http://www.w3schools.com/css/pr_dim_line-height.asp

  17. manstraw
    Member
    Posted 7 years ago #

    instead of line-height, I would suggestion margin-top, but it amounts to the same thing.

    <p style="margin-top: 4ex;">there should be a 4 x height space before this line</p>

    Oh, and I was checking into the rights of each role, and discovered something that might be a factor. It seems there is an "untiltered html" setting for the admin, and editor roles, but it's switched off for authors and below. In other words, it filters for authors and contributors. Perhaps this is where your html is being altered against your will! You can get the Role Manager plugin that will let you specifically set that for individual users.

  18. nickb34
    Member
    Posted 7 years ago #

    Alright, i altered the CSS, and I guess it puts more spacing in between the paragraphs, but there still not spaces.

    The whole point of the thread is to be able to put spaces in, with breaks, not just to increase the space between paragraphs, or tags, seems like a simple thing, but its turning out to be a complicated matter.

  19. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Nick: Above, where you say it filtered out the break tag... What do you mean? It didn't filter out the break tag, the break tag did exactly what it was supposed to do, it went to a new line.

    What I see on your above post:
    Still filtering the
    's out.

    See? Two lines. The break did what it does, it added a line break.

    Maybe if you posted a link to your blog so that we could see the resulting problem posts you're making, we'll be able to give you better advice.

  20. nickb34
    Member
    Posted 7 years ago #

    Hey, i see your point. Its still not doing what i want it to do. What if you want 10 of them? What if you want to type a little bit, put 10 spaces and then continue?

    Please see here:

    http://www.nickb.ca/breaks

    I have tried this process with the editor on off, manually entering the code, or hitting enter and return, its all the same.

    Hope that gives you a better understanding,
    --nick

  21. wzrd
    Member
    Posted 7 years ago #

    I know exactly what Nick is saying... In previous versions and with previous WYSIWYG editors (for wordpress), you could have extra spaces.

    If you enter the following:
    paragraph of text1
    hit enter 5 times
    paragraph of test2

    You get:
    paragrahp of text1
    paragraph of text2

    I too would like the editor to allow more CR/LF when wanted. And using the HTML button and using the source doesn't solve the problem either.

  22. manstraw
    Member
    Posted 7 years ago #

    I'm confused about something. Why can't the space be created using an inline style instead of br tags?

    And did you check out the "unfiltered html" issue I mentioned for admins, editors, and authors?

  23. nickb34
    Member
    Posted 7 years ago #

    I want it to be quick, i dont want to have to mess around with styles in the post to get a couple spaces in.

    Also, i made another user as an author and tried it and still no luck. I have not tried the plugin however, but i will definately check it out.

  24. wzrd
    Member
    Posted 7 years ago #

    Heck, as I just found out, the editor removes breaks from blockquotes too. So if I'm blockquoting what a person said, it no longer has the formatting of that how they typed it.

  25. wyrd33
    Member
    Posted 7 years ago #

    I believe the WP filters are whats doing it. You should be able to disable any filter, it's just a question of finding which one is removing the extra break lines.

    If I had to guess, it'd be wpautop. So to disable it, throw this inside your template's funtions.php:

    remove_filter("the_content", "wpautop");

    wpautop can be found in functions-formatting.php, line 57. For other filters that WP uses, take a look in default-filters.php and kses.php line 523. All filter functions (with the exception of kses) can be found in functions-formatting.php.

    Hope this helps.

    EDIT: Oh, and don't use the rich text editor. It does more filtering which I don't believe you can disable without hacking WP core code. Maybe I'm wrong, but the rich text editor seems to have the following filter, and I don't see a way to disable it:

    function wp_richedit_pre($text);

    functions-formatting.php, line 1006.

  26. nickb34
    Member
    Posted 7 years ago #

    Works! FINALLY. Thank you all very much for the help.

    The Fix:

    Add "remove_filter("the_content", "wpautop");" to your themes functions.php, and disable the rich text editor.

    When entering
    tags or tags, it doesnt filter the spacing out for either of them.

    Also, if you want to use the <b>, and <i> buttons etc on the editor (the one you get when you turn rich editing off) they all still work.

    --nick

  27. Lance Fordham
    Member
    Posted 7 years ago #

    Thank you for working through this... I too was having the same problem; it's very frustrating when trying to format a page so that it looks halfway decent. Unfortunately, WordPress is loosing the flair it once had, at least in my opinion.

  28. Lance Fordham
    Member
    Posted 7 years ago #

    I have found a problem though... I have no functions.php page... Any ideas?

  29. nickb34
    Member
    Posted 7 years ago #

    Just make one in your template directory? Im not sure, thats what i would try....

  30. manstraw
    Member
    Posted 7 years ago #

    Glad you've got it sorted. I supposed something like this could be an option in the admin area. However, I see this as a step backwards. I view it like when I receive a document from someone that I will use in print publishing (or web or that matter), and they've put in returns after every line instead of only at the end of the paragraph, and they've inserted spaces to get text over instead of using a tab. Perhaps it takes moment longer to set a tab, but that's only once, and then you just need to hit tab. I spend a lot of time cleaning up a document I receive so it will flow properly despite the page dimensions. Same with a style sheet on a web page. You need to take a moment longer to define a style, but after that, it's much faster to tag your content appropriately and let css do the spacing. I don't want to turn this thread into a debate about web standards, but I do think it's important to consider two things. One) that people who visit your site with non standard browsers have a hard time getting passed the extra br's etc. Imagine someone who is viewing with a cell phone for example (and that's just one example). Two) Consider the work you will need to do to clean up all the extra code when you change your the style of your website. If you did in a style sheet, it can be done for all of them in about 30 seconds. If you need to manually remove all the br's, you best order dinner in, you'll be working late.

    I'm glad you've got what you wanted, but I don't think wordpress as a whole should support that way of making pages. It rightfully cleans up a lot of junk in my opinion. The 'new way' is to separate style and content. There are many good reasons for this. The html tags are there to tell the browser what something is, not how it should look.

Topic Closed

This topic has been closed to new replies.

About this Topic