Posted By

mzym on 09/22/09


Tagged

mysql php Smarty wordpress excerpts


Versions (?)

Output WordPress Excerpts


 / Published in: PHP
 

Create an own query to WordPress for your own templates (i.e. Smarty)

  1. function outputExcerpts() {
  2.  
  3. $result_list = mysql_query("SELECT * FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date DESC");
  4. if ($myrow_list = mysql_fetch_array($result_list)) {
  5. do {
  6. $listExcerpts[] = $myrow_list;
  7. } while ($myrow_list = mysql_fetch_array($result_list));
  8. }
  9.  
  10. return $listExcerpts;
  11.  
  12. }

Report this snippet  

You need to login to post a comment.