<?php
/*
:: Retrieve and display all posts from a Wordpress blog
*/
function GetPosts()
{
$con = mysql_connect('localhost','username','password');
mysql_select_db('wp-database-name',$con);
$query = mysql_query("SELECT post_title FROM wp_posts",$con);
$html = '';
while($row = mysql_fetch_assoc($query))
$html .= '<p><strong>'.$row['post_title'].'</strong></p>';
return $html;
}
?>
<div>
<h2> {title} </h2>
<?php echo GetPosts(); ?>
</div>
|