how to add line breaks for post custom fields (2 posts)

  1. edalbkrad
    Posted 3 years ago #

    this adds my custom field that shows a detailed receipt after a buyer pays for an item.
    The problem is the textarea doesnt have spacing, it just becomes one big paragraph.

    <?php } else { echo get_post_meta($transaction_childdeal->post_id,'voucher_text',true); }} ?></p>
            <p class="shipping_address">
            <?php { echo get_post_meta($transaction_childdeal->post_id,'inclusions',true); } ?></p>
            <p class="shipping_address">
            <?php { echo get_post_meta($transaction_childdeal->post_id,'conditions',true); } ?></p>

    this is a screenshot result of that code
    as you can see the text on terms & conditions is just one big paragraph with no spacing.

  2. toocoolone
    Posted 3 years ago #

    If your field is stored with new lines between each item in the list you could just do this...

    <p class="shipping_address">
            <?php { echo nl2br( get_post_meta($transaction_childdeal->post_id,'conditions',true) ); } ?></p>

    I'm not sure how the items are stored so that may not work!

Topic Closed

This topic has been closed to new replies.

About this Topic