SHARE
TWEET

Untitled

a guest Dec 15th, 2015 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function prefix_get_post_id() {
  2.  
  3.   if ( is_ssl() ) {
  4.     $protocol = 'https://';
  5.   } else {
  6.     $protocol = 'http://';
  7.   }
  8.  
  9.   if ( is_front_page() ) {
  10.     $post_id = get_option('page_on_front');
  11.   } else if ( is_home() ) {
  12.     $post_id = get_option( 'page_for_posts' );
  13.   } else {
  14.     $post_id = url_to_postid( $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ) );
  15.   }
  16.  
  17.   return $post_id;
  18.  
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top