views:

19

answers:

1

In header.php, is there some way to detect and alert which template is displaying the current page? For example, I attempted something like:

<script type="text/javascript">
alert("<?php echo is_page_template(); ?>");
</script>

I would prefer an answer that doesn't require me to explicitly state and test each filename in that alert. But, even when I did put in a template file's name, it alerted blank rather than true or false. Any ideas?

+1  A: 

You can do the following:

get_post_meta($post->ID,'_wp_page_template',true);
jrtayloriv