Title: Page-specific variable?
Last modified: August 18, 2016

---

# Page-specific variable?

 *  [pcmt](https://wordpress.org/support/users/pcmt/)
 * (@pcmt)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/)
 * Is there a standard page-specific php variable that can be identified on each
   page. I would like to use this to format my navigation bar.
 * Many thanks.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [masquerade](https://wordpress.org/support/users/masquerade/)
 * (@masquerade)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/#post-231861)
 * if(is_page())
 *  Thread Starter [pcmt](https://wordpress.org/support/users/pcmt/)
 * (@pcmt)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/#post-231864)
 * Thanks, but what goes inside the brackets? What is the actual page-specific variable?
   Or is it a string?
 *  [masquerade](https://wordpress.org/support/users/masquerade/)
 * (@masquerade)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/#post-231865)
 * That’s what you can use to tell if its a page or not, for example
 * `<?php
    if(is_page()) { //anything here is executed }
 *  Thread Starter [pcmt](https://wordpress.org/support/users/pcmt/)
 * (@pcmt)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/#post-231867)
 * Yes, but what I want to do is to know which page it is, so that I can format 
   my navbar accordingly. For example “if (is_home())” identifies that it is the
   homepage, but I’m not sure how. I’m looking for something like “if (is_somepage())”–
   so what sets “somepage” for each of my pages?
 *  Thread Starter [pcmt](https://wordpress.org/support/users/pcmt/)
 * (@pcmt)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/#post-231871)
 * Actually, it seems to work by using the page slug:
 * if (is_page(‘my-page-slug’)) {

Viewing 5 replies - 1 through 5 (of 5 total)

 The topic ‘Page-specific variable?’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 5 replies
 * 2 participants
 * Last reply from: [pcmt](https://wordpress.org/support/users/pcmt/)
 * Last activity: [21 years, 3 months ago](https://wordpress.org/support/topic/page-specific-variable/#post-231871)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
