Get current page name in header.php
-
Is there a way to reduce this to
<?php if (is_page('about')): ?> <script type="text/javascript">var page = "about";</script> <?php endif ?> <?php if (is_page('contact')): ?> <script type="text/javascript">var page = "contact";</script> <?php endif ?> <?php if (is_page('gallery')): ?> <script type="text/javascript">var page = "gallery";</script> <?php endif ?>
<script type="text/javascript">var page = "<?php echo get_current_page() ?>";</script>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get current page name in header.php’ is closed to new replies.