I noticed that when I call the the_post() or the_content() function from my wordpress template, it automatically parses the database data to replace new lines with <br/>
, wraps the text with <p>
tags etc...There's probably some kind of "format" function within the_post() or the_content().
I wrote a query to directly get posts from the wp_posts. I then print it out like
<?php
$results = $wp->get_results($sql)
foreach($results as $row) echo $row->post_content; ?>
Clearly, this data is not parsed by wordpress' "format" function. What is the proper way to output this content such that it undergoes the same "formatting" functions as the_post() or the_content()?