Skip to main content
Known Participant
August 16, 2012
Question

WP post echo not honoring line breaks

  • August 16, 2012
  • 1 reply
  • 772 views

I am using DreamWeaver server connections and Binding to echo back WordPress posts to certain divs on static pages and all is well including the css to style the echo. One BIG problem is that the echo does not honor line breaks. How can I maintain the line breaks?

This topic has been closed for replies.

1 reply

Community Expert
August 17, 2012

You'll have to insert them in the echo.

  

<?php echo $row_myPostsRS["postField"]. " </li>"; ?>

AWP64Author
Known Participant
August 18, 2012

Rick, before I read your reply I noticed something I had not seen the the several other occassions I echoed a post to a static page. In the DW Binding Panel on the right hand side there was a notification that the 'post_content' was not formatted. Along with the notice under the format menu head there was a pull-down menu and I made the selection which indicated the insertion of line returns (sorry, the menu is no longer available in the Bindings Panel and I can not recall the exact name of the selection. When I went to the page code I see

' <p class="eventsPost_content"><?php echo nl2br($row_events['post_content']); ?></p>'

The nl2br and the parenthesis were added and the echo now has line breaks.

Any idea why I was prompted for a format selection? As I mentioned the few other echos I have tried went off without a hitch. Now that I think about it the content in the blog on the other occassions were typed and this last blog content was copied and pasted from a text editor. Any significance?

Thanks in advance