title: Where to put my custom functions in Wordpress?
body: <p>I am pulling my hair out.  I have created some simple functions that generate random numbers, pulled from a database that I want to use on wordpress pages. (And then call them from the theme files, such as header.php or page.php.)</p>
  
  <p>I have tried putting the functions inside functions.php that is in the theme (as per the documentation I have read), but I keep getting the "call to undefined function" errors! What in the world am I doing wrong?</p>
  
  <p>Example, here is a function inside the functions.php</p>
  
  <pre><code>function randomPollNumber() {
  ///this gets a random active poll number
      $sql12 = "SELECT id FROM poll WHERE removed = 0 AND active = 1 ORDER BY RAND() LIMIT 1";
      $result12 = mysql_query($sql12);
      $myrow12 = mysql_fetch_row($result12);
      $pollquestionid = $myrow12[0];
      return $pollquestionid;
  }
  </code></pre>
  
  <p>And I am calling it, from the header.php file with this</p>
  
  <pre><code>&lt;?php echo randomPollNumber(); ?&gt;
  </code></pre>
  
  <p>And yes, I DID try using the if_function_exists, but of course it cannot FIND the function, so of course it does not exist.  Please help?</p>