Auto adding paragraphs to custom fields with 'wpautop'?
-
Hi,
I have a function which is the post’s long description, and this is the function’s code which is located in single.php (Single Post):
<p id="long-desc"><?php echo get_post_meta($post ->ID, 'long-desc',true); ?></p>
But the problem is that when I write the long description in its custom field, I need to add the paragraphs or the linebreakers manually with HTML to the custom field, it won’t do it automatically.
But now I’ve found a function which should do this autmatically for me. It’s called for ‘wpautop’. You can read more about the function here: https://codex.www.ads-software.com/Function_Reference/wpautop
But how do I add its code
<?php wpautop( $foo, $br ); ?>
to my long description’s function code<p id="long-desc"><?php echo get_post_meta($post ->ID, 'long-desc',true); ?></p>
?I’ve tried to “merge” these two codes in a lot of different ways, but I can’t get it to work.
Thanks & best regards,
Jimmy
- The topic ‘Auto adding paragraphs to custom fields with 'wpautop'?’ is closed to new replies.