WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using is_page in my functions.php file to display some code and I wanted only to display the code in the header if the contact page is being shown. I made a template called contact.php and in the top did the template name: contact. The templates shows just fine but when I went into the functions file and did is_page('contact') or is_page('contact.php') the code stopped working. Is the function based on the permalinks settings? right now I have wordpress setup for default so instead of showing contact.php in the address bar, it shows ?page_id=94. If I do is_page(94) then my test code works

share|improve this question
up vote 1 down vote accepted

If the page slug is 'contact' then is_page('contact') should work. You can check out the optional parameters for page in the codex here . Using post ID, e.g. 94 in your example will work regardless of permalink settings.

If you want it to display for a specific template you can use is_page_template('contact.php').

share|improve this answer
OH, that makes sense. Thaks for the tips. – Jamie Aug 1 '12 at 1:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.