Advertisement
bhengh

SB bad link fix: sermon.php

Feb 11th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. /**
  2. * Get the page_id of the main sermons page
  3. *
  4. * @return integer
  5. */
  6. function sb_get_page_id() {
  7. global $wpdb, $post;
  8. $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();");
  9. if (!$pageid)
  10. $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();");
  11. if (!$pageid)
  12. $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();");
  13. if (!$pageid)
  14. return 0;
  15. else
  16. return intval($pageid);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement