Gabe462
Member
Posted 2 years ago #
I thought that get_post() was failing to display the <p> tags of my pages, but then realized that the <p>'s aren't stored in the text in the database anyway.
On my page.php (copied from kubrick theme), the_content() adds <p> tags around paragraphs. How can I add <p> tags to my content that I'm retrieving using get_post()?
tia,
G462
Gabe462
Member
Posted 2 years ago #
I'm still trying to figure out how to parse get_post() output to add <p> tags around paragraphs. I'm reading about how using the $output parameter might help, but nothing's clicked for me yet. Is there just another function I can parse the returned object with?
It seems that my other option might be using wp_query() to (I'm not sure what yet). If I'm not going to be able to do this with get_post(), can someone point me to a resource on the intricacies of using wp_query()?
G462
dazonic
Member
Posted 2 years ago #
Use the wpautop() function.
wpautop($post->post_content);
I think this way is better
$content = apply_filters('the_content', $post->post_content);
Brianair
Member
Posted 1 year ago #
The WordPress wpautop filter changes BR and P tags as if the simple carriage return is banished to history. All through the night, I installed and uninstalled editors and plugins, and inserted code snippets.
To force a line break, use the HTML editor and place this code at the end of the line. Probably unwittingly, wpautop ignores it:
<br clear="none" />
That's pretty easy relief!