Title: Splitting sidebar code from template
Last modified: August 18, 2016

---

# Splitting sidebar code from template

 *  [pramclub](https://wordpress.org/support/users/pramclub/)
 * (@pramclub)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/splitting-sidebar-code-from-template/)
 * The theme I use is Sharepoint Like, which I downloaded fro Alex King’s site (
   [http://alexking.org/projects/wordpress/themes](http://alexking.org/projects/wordpress/themes))
   and the header, footer and sidebar code is all included in the main page template.
 * I haven’t upgraded to 2.1 yet, but before I do is this the time I should think
   about splitting the code into separate files? I’ve only been using WP for a month,
   so I don’t want to take on anything that’s going to cause a zillion problems.
   I’m experienced with HTML and some CSS, but this is my first experience with 
   php.
 * TIA

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

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 4 months ago](https://wordpress.org/support/topic/splitting-sidebar-code-from-template/#post-514990)
 * It’s easy. Take the sidebar code. Copy and paste it into a file called “sidebar.
   php”. Where the sidebar code was, put this:
    `<?php get_sidebar(); ?>`
 * Done and done. You can also do this with these:
    `<?php get_header(); ?>` `<?
   php get_footer(); ?>` to refer to header.php and footer.php, respectively.
 * These three are special cases in WordPress and so have their own functions to
   deal with them.
 *  Thread Starter [pramclub](https://wordpress.org/support/users/pramclub/)
 * (@pramclub)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/splitting-sidebar-code-from-template/#post-515002)
 * Thanks Otto – is it better to have separate files for these sections? Many templates
   seem to be created that way, and I’m not sure if that’s a more recent method,
   which will become a required standard in WP eventually.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 4 months ago](https://wordpress.org/support/topic/splitting-sidebar-code-from-template/#post-515003)
 * “Better” is a relative term. I like having them separate, but some people don’t.
   There can be pros and cons either way.
 * I’d separate them, but that’s just me. I like them separate to keep them clearly
   defined.

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

The topic ‘Splitting sidebar code from template’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [19 years, 4 months ago](https://wordpress.org/support/topic/splitting-sidebar-code-from-template/#post-515003)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
