Forums

Generating own html using php - how to insert line break? (4 posts)

  1. GregTallent
    Member
    Posted 6 years ago #

    I know wp puts in line breaks in the posts in the html it generates. I'm using my own php file - must be mad :-) - is there any simple way I can put the line break in myself?

    Thank you
    Greg
    http://www.bearstorm.com

  2. Kafkaesqui
    Moderator
    Posted 6 years ago #

    Any HTML tags you manually place in a post are retained by WordPress, and it should not attempt to double-up on them (i.e. place paragraph tags around yours, etc).

  3. GregTallent
    Member
    Posted 6 years ago #

    Thank you, Kaf.
    I should have been clearer. I'm generating the web pages using php pages, not using WP. When I put a post in the db, I just use an 'enter' for a line break. Looks fine in the post form. When my php page picks up the post from the db, I need to put a line break in where it should be before displaying. I know WP does this. I need a little php code to do the same thing, but I don't know what to look for in the post to replace.
    Best wishes
    Greg

  4. coolphpdude
    Member
    Posted 5 years ago #

    You should try the nl2br function. You can read about it at the PHP website here:

    http://us2.php.net/nl2br

    CoolPHPDude

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags