How To Add Empty Lines In WordPress Posts October 25th, 2009
Easy; well you’d have thought so wouldn’t you?
For a while now I have been trying various different ways to try and achieve something which let’s face it, should be really simple – how do you add an empty line into a WordPress blog. I thought that I must be missing something fundamentally obvious; I couldn’t believe that this was not possible in an up-to-date release of WordPress.
Surely the ability to do this was not missed out? Almost everyone wants to add empty or blank lines to format their text. Often you need to add a little bit of white space to make the post look clean or in my case, after inserting an image into your post so that the following text looked properly aligned. But in WordPress it seems like they’ve gone to great effort to make this an impossible and death defying feat. Personally, I just don’t get it.
If you enter a blank line in the WYSIWYG editor, as soon as you click on the save or publish button, all of the empty lines disappear and all of your text gets crunched up again. Type them back in and save. Poof! Like magic they disappear again, gone. What’s that all about?!
So I thought about doing it the manual way, by coding them manually in the html view (which when you think about it defeats the object, you shouldn’t need to know html to be a blogger as the WYSIWYG editor should decipher the html for you…), did that work? No.
I’d tried all the things I could think of. Nothing seemed to work, as soon as I hit the save or publish button any code that I had put in disappeared into cyberspace never to be seen again. There doesn’t seem to be any conclusive solution in the WordPress support forums either which isn’t very helpful. The best solution that I could find was to increase the paragraph spacing in css, but that wasn’t really something I wanted to do.
I did a lot of searching around various sites and kept hitting a brick wall, there do seem to be a lot of people having the same problem – with various potential workarounds – but doesn’t seem to be any consistent solutions, what seems to work for some doesn’t for others. I guess that’s the beauty of all the customised installations, themes and plug-ins etc. Most people are overcoming the problem by installing various plug-ins to stop WordPress from stripping out the code. Messy; all these extra plug-ins increase the burden to the default WordPress installation and eventually slow things down, again not something I want to happen.
So, how have I achieved it?
Well, I came across it by chance when I was writing a post and had to ‘play back’ what I had done to find the solution. It’s actually really simple.
On the WYSIWYG editor place the cursor where you want the blank line to appear, next click the html editor tab. Hit the code button and overtype the word ‘code‘ with ‘br’ on the screen within the < and >. Save. That’s it..!
Seems to work great for me; let me know if you find this useful.
5 Responses
Simon Says:
is the html for pagebreak.
Another option could be to user a spacer .gif set to the size of whitespace that you want. You can also play about with the style sheets if you have one set up
Mike Says:
Simon, the html code doesn’t work correctly, that’s the point; it should but it doesn’t. It appears to work absolutely fine until you save the post at which point all the html is parsed and WordPress takes it upon itself to strip code relating to empty space or line breaks. Of course, you could use an object to create the illusion of the space such as a spacer.gif image as you suggest, or even a text entry of ‘.’ with the text colour set to mimic the background space so that it becomes invisible, but then you are essentially having to do far more than the method I suggested. I just want a simple method to format my posts the way I want them to look…
Mike Says:
Curious. I’ve just done a test post to try that and it does seem to work. I say curious because I know I have tried that before and it didn’t work, it was one of the first things I tried if I remember rightly as it was one of the most obvious. Very strange, but I’m not complaining. Thanks!
jonny bowley Says:
hitting the enter button twice works for me. although i find having to do that incredibly annoying.