Advertisement
Guest User

Untitled

a guest
Dec 15th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement