Title: include a page
Last modified: August 19, 2016

---

# include a page

 *  [Copywrite](https://wordpress.org/support/users/copywrite2012/)
 * (@copywrite2012)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/)
 * Hi all
    I have this code on my index page which works fine. `<?php include (TEMPLATEPATH.'/
   sidebar1.php'); ?>` I have a block of code that I want to use across my blog.
   So I cut the code and paste it in a new php file and save it in my theme folder.
   Then I can use the same code above just changing the filename correct? TIA

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868236)
 * Rename sidebar1.php to sidebar-one.php and then use `<?php get_sidebar('one');?
   >`
 *  Thread Starter [Copywrite](https://wordpress.org/support/users/copywrite2012/)
 * (@copywrite2012)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868246)
 * Thanks, so what is the difference between templatepath and get_sidebar- obviously
   sidebar is a function?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868251)
 * `TEMPLATEPATH` shouldn’t be used in themes. It’s for internal core use only.
 *  Thread Starter [Copywrite](https://wordpress.org/support/users/copywrite2012/)
 * (@copywrite2012)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868257)
 * So I should change the instances of TEMPLATEPATH to `get_sidebar('/sidebar1.php')`
   for my code in index.php and archive.php?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868263)
 * No – use the approach I outlined above.
 *  Thread Starter [Copywrite](https://wordpress.org/support/users/copywrite2012/)
 * (@copywrite2012)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868278)
 * OK so I change my original code from `<?php include (TEMPLATEPATH . '/sidebar1.
   php'); ?>` to
 * `<?php getsidebar('/sidebar1.php'); ?>`
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868300)
 * No! Rename sidebar1.php to sidebar-one.php and then use `<?php get_sidebar('one');?
   >`
 *  Thread Starter [Copywrite](https://wordpress.org/support/users/copywrite2012/)
 * (@copywrite2012)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868422)
 * OK got you thanks!

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

The topic ‘include a page’ is closed to new replies.

 * 8 replies
 * 2 participants
 * Last reply from: [Copywrite](https://wordpress.org/support/users/copywrite2012/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/include-a-page/#post-1868422)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
