Wordpress parses wp_posts.post_content before rendering?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-06-11T18:18:36Z Indexed on 2010/06/11 18:22 UTC
Read the original article Hit count: 186

Filed under:

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()?

© Stack Overflow or respective owner

Related posts about Wordpress