Title: Problems with is_page()
Last modified: August 18, 2016

---

# Problems with is_page()

 *  [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/)
 * Hi, I have this code:
 *     ```
       <?php if (is_page('2')) { ?>
             <h3>Title</h3>
             <p>Text</p>
   
        <?php } ?>
       ```
   
 * But it doesn’t work. Any solution?

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588054)
 * Where do you have that code?
    What is it supposed to do? (according to you) Link
   to an example? Doesn’t work meaning… ?
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588055)
 * Ok, I have that code in an include archive.
    At the end of the index.php I have
   the next code:
 * `<?php include (TEMPLATEPATH . '/columna3.php'); ?>`
 * And in this archive I have the is_page.
    If I am in a page with id=2, it must
   show me a title with some text. But nothing happens.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588056)
 * So, is that conditonal in:
    – index.php? – columna3.php What is “include archive”?
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588058)
 * The conditional is in columna3.php
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588059)
 * Do you have a page.php template file in your theme? If yes, then index.php is
   NOT used to display your page_id=2 – which means the code is useless in index.
   php.
 * The conditional you are using is for [Pages](http://codex.wordpress.org/Pages).
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588063)
 * I dont’t understand. I have a page.php template file. But what can I do???
    columna3.
   php is called from index.php and from page.php. And never happens anything.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588065)
 * If it is called into the page.php, too – then it should work.
 * Give a link to your Page that has ID#=2.
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588066)
 * [http://www.address.com/page/](http://www.address.com/page/)
 * **[mod – you edited the address, and it is wrong now! your page_id=2 was the 
   About Page]**
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588068)
 * Put your columna3.php to [http://wordpress.pastebin.ca](http://wordpress.pastebin.ca)
   and post back with the address
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588070)
 * [http://wordpress.pastebin.ca/597677](http://wordpress.pastebin.ca/597677)
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588073)
 * I don’t know where is the problem. I have used the same in previous wordpress
   versions.
 *  Thread Starter [grunlof](https://wordpress.org/support/users/grunlof/)
 * (@grunlof)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588241)
 * is functions don’t work. Any idea?
 *  [syncbox](https://wordpress.org/support/users/syncbox/)
 * (@syncbox)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588502)
 * Assuming you are wanting to put in your own text, you could do this, using echo
   to write the stuff you add:
 *     ```
       <?php if (is_page('2')) {
        echo('<h3>Your Title here</h3><p>your text content here</p>');}
       else {}
   
        ?>
       ```
   
 * or, if you want to pull the actual title and content from the db, then you do
   something like:
 *     ```
       <?php if (is_page('2')) {
       the_title('<h2>','</h2>');
       the_content();
       }
       else {}
   
        ?>
       ```
   
 * is that what you are after?
 * HTH

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

The topic ‘Problems with is_page()’ is closed to new replies.

## Tags

 * [conditionals](https://wordpress.org/support/topic-tag/conditionals/)
 * [is_page](https://wordpress.org/support/topic-tag/is_page/)
 * [problem](https://wordpress.org/support/topic-tag/problem/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 3 participants
 * Last reply from: [syncbox](https://wordpress.org/support/users/syncbox/)
 * Last activity: [18 years, 9 months ago](https://wordpress.org/support/topic/problems-with-is_page/#post-588502)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
