Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. /**
  2.  * Get global id
  3.  *
  4.  * @since 1.0.0
  5.  * @return int $post_id
  6.  */
  7. if ( ! function_exists( 'sb_global_id' ) ) {
  8.     function sb_global_id() {
  9.  
  10.         global $post;
  11.  
  12.         $post_id = $post->ID;
  13.  
  14.         return (int)$post_id;
  15.  
  16.     }
  17. }
  18.  
  19. /**
  20.  * Check whitespace or empty
  21.  *
  22.  * Callback for array_filter to filter an array's values
  23.  * for whitespace or empty strings and remove it
  24.  *
  25.  * @since 1.0.0
  26.  * @param string $val
  27.  * @return bool
  28.  */
  29. if ( ! function_exists( 'sb_check_whitespace_or_empty' ) ) {
  30.     function sb_check_whitespace_or_empty( $val ) {
  31.  
  32.         return $val != '' || preg_match( '/\S/', $val );
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement