Title: Custom page.php for post &amp; pages
Last modified: August 20, 2016

---

# Custom page.php for post & pages

 *  Resolved [James](https://wordpress.org/support/users/sureshkutti/)
 * (@sureshkutti)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/custom-pagephp-for-post-pages/)
 * Hi…I have page template. In that i need to add custom code like if its page need
   to get the templates else if its post need to get blog post.
 * <header>
    is_page() { display template…. post() { display blog post/ template…
   <footer>
 * Thanks

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

 *  [Beee](https://wordpress.org/support/users/beee/)
 * (@beee)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/custom-pagephp-for-post-pages/#post-3215141)
 *     ```
       if ( is_page() )
       {
         // do page action
       }
       else if ( is_single() )
       {
         // post action
       }
       else // if not is_page() or is_single()
       {
        // other action
       }
       ```
   
 *  Thread Starter [James](https://wordpress.org/support/users/sureshkutti/)
 * (@sureshkutti)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/custom-pagephp-for-post-pages/#post-3215157)
 * Thanks
 *  [Beee](https://wordpress.org/support/users/beee/)
 * (@beee)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/custom-pagephp-for-post-pages/#post-3215158)
 * Could you mark this topic as resolved ?

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

The topic ‘Custom page.php for post & pages’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Beee](https://wordpress.org/support/users/beee/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/custom-pagephp-for-post-pages/#post-3215158)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
