First off I have gone through this link http://codex.wordpress.org/Integrating_WordPress_with_Your_Website. I cannot use this.
I am trying to get the latest post from a WordPress installation on a remote server I own. They share the same database server so that is where I am taking the post now and then brining it back into my PHP app. This all works.
What doesn't work is the display. Before I was using nl2br
to make new lines but this does not work right.
I have noticed that WordPress does some post-processing to add p
tags to certain lines they consider should be paragraphs (not in ul
s or li
s for example). They do this after grabbing the post from the DB (the p
tags are not saved to DB).
I have tried to find out what post-processing they use in the source code but I have come up blank after finding the the_content
function etc and where the $post
var comes from but not finding the code I am looking for.
What post-processing function does WordPress use to add these paragraphs to make their posts look ok?
Edit
For regex or general PHP people here I am looking to change something like:
<em><a href="link">awesome link</a></em>
<h3>Awesome Head</h3>
lalalaalal
<ul>
<li>Awesome li</li>
</ul>
Into something like:
<p>
<em><a href="link">awesome link</a></em>
</p>
<h3>Awesome Head</h3>
<p>lalalaalal</p>
<ul>
<li>Awesome li</li>
</ul>
Missing out tags that obviously should not have p
tags around them like h
and ul
and li
tags.