title: WordPress Get the Page ID outside the loop
body: <p>I want to get the page ID before starting the loop in WordPress. I am using </p>
  
  <pre><code>$page = get_query_var('page_id');
  </code></pre>
  
  <p>Apparently, it returns nothing.</p>
  
  <p>I just want to check a page for its ID and add a class to <code>&lt;body&gt;</code> tag based on it.</p>