title: wordpress: get_post() inside of a function
body: <p>I have this function inside of my functions.php file in my theme:
  sample code......</p>
  
  <pre><code>function getTheAuthor($x) {
  global $post;
  $post = get_post($x);
  $author_name = get_author_name($post-&gt;post_author);
  return 'author: '.$author_name;
  }
  </code></pre>
  
  <p>end sample code
  so, $x is a string (let's say "375")
  if I change the line to $post = get_post(375); all works ok, 
  if I leave the line $post = get_post($x), I get a null object....
  If I attempt to convert $x to an integer, it converts that string to zero.  --- and intval($x) = 0;
  What am I missing here?</p>
  
  <p>Thanks for any help</p>