• I’d like to identify a page, and have some special javascript inserted in the head section of the header.php file, but don’t know how to get the page id or page name. I’ve looked through the function reference, but don’t see anything that exactly meets my needs. Is there something I’m missing?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter skunkbad

    (@skunkbad)

    So… I found that I can get the page ID with this:

    $this_page_id = get_query_var(‘page_id’);

    and for one page it correctly returns the number 4, however, on another page it is returning 0. I don’t understand!

    Thread Starter skunkbad

    (@skunkbad)

    I figured it out. I just used $post->ID;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to identify the page in header.php’ is closed to new replies.