Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP for a line break

I currently have the below code outputting a custom field with a title and image but I'm trying to add a line break. As I understand it the echo "/n"; at the end there should be doing the trick.

It's still outputting the data but with no line break - can anybody help out a rather hopeless case like myself :-)

 <?php
$value = get_post_meta( get_the_ID(), 'ecpt_location2', true);
if( !empty($value)) {
    echo '<h5>Location</h5>';
     echo '<img src="/wp-content/uploads/2013/02/Address1.gif">';
    echo $value;
    echo "\n";
}
?>
like image 446
user2061701 Avatar asked May 28 '26 23:05

user2061701


1 Answers

Try nl2br.

echo nl2br($yourTextData);

hope this helps

like image 134
Rachel Gallen Avatar answered May 30 '26 13:05

Rachel Gallen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!