bhengh

sb_get_page_id OLD

May 30th, 2013
44
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sb_get_page_id() {
  2. global $wpdb, $post;
  3. $pageid = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE (post_content LIKE '%[sermons]%' OR post_content LIKE '%[sermon]%') AND (post_type = 'page') AND (post_status = 'publish' OR post_status = 'private') AND post_date < NOW();");
  4. if (!$pageid)
  5. $pageid = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE (post_content LIKE '%[sermons]%' OR post_content LIKE '%[sermon]%') AND (post_status = 'publish' OR post_status = 'private') AND post_date < NOW();");
  6. if (!$pageid)
  7. $pageid = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE (post_content LIKE '%[sermon %' OR post_content LIKE '%[sermons %') AND (post_status = 'publish' OR post_status = 'private') AND post_date < NOW();");
  8. if (!$pageid)
  9. return 0;
  10. else
  11. return intval($pageid);
  12. }
RAW Paste Data