title: Get Current Page Name in WordPress
body: <p>In a WordPress header.php file, is there a way to reduce this :</p>
  
  <pre><code>&lt;?php if (is_page('about')): ?&gt;
  &lt;script type="text/javascript"&gt;var page = "about";&lt;/script&gt;
  &lt;?php endif ?&gt;
  
  &lt;?php if (is_page('contact')): ?&gt;
  &lt;script type="text/javascript"&gt;var page = "contact";&lt;/script&gt;
  &lt;?php endif ?&gt;
  
  &lt;?php if (is_page('gallery')): ?&gt;
  &lt;script type="text/javascript"&gt;var page = "gallery";&lt;/script&gt;
  &lt;?php endif ?&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var page = "&lt;?php echo get_current_page() ?&gt;";
  &lt;/script&gt;
  </code></pre>