.title{ color:blue; } .date{ font-size:11px; } .linkheader{ font-size:15px; } .links{ font-size:11px; } strong{ font-weight:bold; } blockquote.bq{ border-left:2px solid blue;padding-left:10px; } .img{ float:right; } .commentauthor{ font-size:11px; } '; $query = "select wp_posts.ID, post_date, post_title, post_author, post_content, display_name from wp_posts left join wp_users on wp_posts.post_author=wp_users.ID where post_date >= '$date_start' and post_date <= '$date_end' and post_status='publish' and post_type='post'"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $content = cleanup($row["post_content"], "yes"); echo '

'.$row["post_title"].'

'; echo '

Posted'; if($display_author=="yes"){ echo ' by '.$row["display_name"];} echo ' on '.date( "F d, Y", strtotime($row["post_date"]) ).'

'; echo '

'.$content.'

'; if($display_comments=="yes"){ comments($row["ID"]); } echo '

***pagebreak***

'; } mysql_free_result($result); function comments($id){ $query = "select comment_author, comment_date, comment_content from wp_comments where comment_post_id = '$id' and comment_approved = '1'"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows > 0){ echo '

Comments:

    '; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $comment = nl2br($row["comment_content"]); $comment = cleanup($comment, "no"); echo '
  1. '.$comment.'

    Left by '.$row["comment_author"].' on '.date( "F d, Y", strtotime($row["comment_date"]) ).'

  2. '; } echo '
'; } } function cleanup($content, $header){ $content = nl2br($content); $matches= array(); preg_match_all("/(.*?)<\/a>/i",$content,$matches, PREG_SET_ORDER); $content = preg_replace("/(.*?)<\/a>/i",'\\4'.'1',$content); //take out links $content = preg_replace("/<\/param>/i",'{VIDEO: \\2}',$content); //take out youtube videos $content = preg_replace("/\s?<\/embed>/i",'{VIDEO: \\2}',$content); //take out google videos $content = preg_replace("//i",'{VIDEO: \\2}',$content); //take out flash $content = preg_replace("/<\/ol>
/i",'',$content); //take out extra br $content = preg_replace("/(.*)
/i",'

\\1

',$content); //wrap in p tags $content = preg_replace("/

(
)?<\/p>/i",'',$content); //take out extra p's $content = preg_replace("/
<\/p>/i",'

',$content); //take out extra br $content = preg_replace("/
/i",'
\\1
',$content); //format bq $counter = "1"; $tbsearch = explode ("1", $content); foreach ($tbsearch as $key => $value) { if (!$key > 0) { $tbreplaced .= $value; } else { $tbreplaced .= "".$counter."".$value; $counter++; } } $content = $tbreplaced; $links = ""; if (sizeof($matches) > 0){ if($header == "yes"){ $links .= '

Links:

'; } $links .='"; } return $content.$links; } ?>