WordPress and Adding Line Breaks – a Hack
I came across the issue of adding a line break on one of my pages. This page contains an iframe, which may or may not be the root of the problem. My goal was to have a couple of lines of text, space, camera image, space, and a couple more lines of text. I finally got there, but it took a little Googling. I tried using the regular tags; <br> and <br />, but they didn’t work. The original code for the iframe had the image being aligned to the left. By deleting the align code I was able to get the second line of text to move to the bottom of the frame. I still wanted an extra space under the camera image. After Googling for line breaks I stumbled on A Truth Seeker’s blog and copied this little snippet of code: <br clear="none" />
That did the trick. I’m calling this a hack since I didn’t really bother with too much research. I just tried stuff until I got my line break. I’m also a lazy html’er. I only learn code when I want to do something. Please feel free to add your comment, especially if you know what the correct solution should be.
(Edit 1/14/09: Deleted the link to the Harley Cam. Sadly, that page no longer exists.)
(Edit 7/9/2010: Deleted the link to the Truth Seeker’s blog. It apparently no longer exists.)
Comments
24 Responses to “WordPress and Adding Line Breaks – a Hack”
Leave a Reply





[...] strip out HTML tags and simply ignores return as line break. Anyway – a bit of googlage turned up this post: a shining lighthouse in a sea of confused bloggers. It turns out that the relevant code is: [...]
It may be a hack but it flippin works.
Sorry, doesn’t work, just the same as a normal br tag and gets stripped out.
Well, Chris, I just tested it out and it works just fine.
Looks like the reason this works is because however they are detecting the tag and stripping it for a tag, they miss it if it has ANYTHING inside it. This also works for me: . i assume if you just put something inside the tag, it ignores it.
I was also having a lot of problem with line breaks in wordpress. I found a small plugin that solves the problem.
This might help your readers:
http://rubayathasan.com/wordpress/plugin/enabling-line-break-in-wordpress/
I kind of accidentally stumbled across this. If you add the code
<strong></strong>in where you want the line break it seems to work. Not a great solution, but the quickest i can think of
Unfortunately it doesn’t work for me either. WordPress just strips the code out. That’s what seems to be the problem, wordpress stripping any sort of line break code out.
Actually I just found that this works:
Whoops, try this maybe (node sure if “code” tags work in the comment field)?
<br class="blank" />
Just an FYI to anyone wanting to post a comment; the “code” tags do work in the comment box. Thanks for everyone who has been contributing.
Thank you so much for this little tip. It made my day alot easier.
Thank you for posting this code. I worked perfect for me!
is easier to remember though
[code]
[/code]
can’t show the code…
Good luck to you all!
Use this, minus the spaces.
sorry, this blog stripped out my code. Trying again.
it is a p tag, a code tag, a br/ tag, a close code tag, and a p tag.
Without the “<" it is;
p code br/ /code p
"
“There is obviously a lot to know about this. There are some good points here.
THANK YOU FOR POSTING THIS!!! I’ve been searching for a for word press all morning!
YOU are THE MAN
word press … (BREAK)…
Works for me! Thx.
Just add this before every paragraph
<  />
This was super helpful. I’ve been Googling for a while looking for a simple fix. This rocks! Thank you.