Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bg_get_all_wp_posts($post_type) {
- global $wpdb;
- $querystr = "
- SELECT $wpdb->posts.*
- FROM $wpdb->posts, $wpdb->postmeta
- WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
- AND $wpdb->postmeta.meta_key = 'my_custom_field'
- AND $wpdb->posts.post_type = " . $post_type . "
- ORDER BY $wpdb->posts.post_date DESC
- ";
- $pageposts = $wpdb->get_results($querystr, OBJECT);
- return $pageposts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement