pork-chop
pork-chop

Reputation: 83

Wordpress ACF: Querying Relationship, keeping paragraph breaks

I'm using the Wordpress plugin Advanced Custom Fields to tie data together into a single post.

Here is my query for one of the relationships:

<?php $notes = get_field('episode_notes'); ?>
<?php if(!empty($notes)): ?>
    <?php foreach($notes as $note): ?>
        <div class="note"><?php echo $note->post_content); ?></div>
    <?php endforeach; ?>
<?php endif; ?>

The post_content is being returned without any paragraph/line breaks (though italics, bold, etc. seem okay). I've tried this without across-the-board success:

<?php echo str_replace('\r','<br>', $note->post_content); ?>

What do I need to do differently?

Upvotes: 0

Views: 106

Answers (1)

Shaun
Shaun

Reputation: 642

Have you tried wpautop?

<?php echo wpautop( $note->post_content, true ); ?>

Upvotes: 1

Related Questions