| | 1472 | function get_posts($args) { |
|---|
| | 1473 | global $wpdb, $tableposts; |
|---|
| | 1474 | parse_str($args, $r); |
|---|
| | 1475 | if (!isset($r['numberposts'])) $r['numberposts'] = 5; |
|---|
| | 1476 | if (!isset($r['offset'])) $r['offset'] = 0; |
|---|
| | 1477 | // The following not implemented yet |
|---|
| | 1478 | if (!isset($r['category'])) $r['category'] = ''; |
|---|
| | 1479 | if (!isset($r['orderby'])) $r['orderby'] = ''; |
|---|
| | 1480 | if (!isset($r['order'])) $r['order'] = ''; |
|---|
| | 1481 | |
|---|
| | 1482 | $now = current_time('mysql'); |
|---|
| | 1483 | |
|---|
| | 1484 | $posts = $wpdb->get_results("SELECT DISTINCT * FROM $tableposts WHERE post_date <= '$now' AND (post_status = 'publish') GROUP BY $tableposts.ID ORDER BY post_date DESC LIMIT " . $r['offset'] . ',' . $r['numberposts']); |
|---|
| | 1485 | |
|---|
| | 1486 | return $posts; |
|---|
| | 1487 | } |
|---|
| | 1488 | |
|---|