Title: Include functions
Last modified: August 22, 2016

---

# Include functions

 *  Resolved [Samar Hatem](https://wordpress.org/support/users/samar-hatem/)
 * (@samar-hatem)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/)
 * Hi there,
    I’m new to WordPress and i want to know the difference between **`
   get_sidebar('main');`** and **`get_template_part('sidebar','main');`** ? thanks
   in advance

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

 *  [respectyoda](https://wordpress.org/support/users/respectyoda/)
 * (@respectyoda)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223599)
 * Hello! Welcome to WordPress!
 * The difference between those functions is that the first pulls from a file called
   sidebar-main.php while the second pulls from a file called template-sidebar-main.
   php.
 * Hope this helps!
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223620)
 * review:
    [http://codex.wordpress.org/Function_Reference/get_sidebar](http://codex.wordpress.org/Function_Reference/get_sidebar)
   [http://codex.wordpress.org/Function_Reference/get_template_part](http://codex.wordpress.org/Function_Reference/get_template_part)
 * the difference is the default action if the targeted file does not exist:
 * `get_sidebar('main')` will call the sidebar.php file, while `get_template_part('
   sidebar','main')` will call no file.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223621)
 * review:
    [http://codex.wordpress.org/Function_Reference/get_sidebar](http://codex.wordpress.org/Function_Reference/get_sidebar)
   [http://codex.wordpress.org/Function_Reference/get_template_part](http://codex.wordpress.org/Function_Reference/get_template_part)
 * generally, the difference is the default action if the targeted file does not
   exist:
 * `get_sidebar('main')` will call the **sidebar.php** file of the theme, or if 
   that does not exist, then call a default file from **wp-includes/theme-compat/
   sidebar.php**
 * while `get_template_part('sidebar','main')` will call **sidebar.php** from the
   theme, or if that does not exist, no file.
 *  Thread Starter [Samar Hatem](https://wordpress.org/support/users/samar-hatem/)
 * (@samar-hatem)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223750)
 * Thanks a lot to all of you, but do you think if i want to include additional (
   another customized) sidebar on a page I should use `get_sidebar('left');` for
   example rather than `get_template_part('sidebar','left');` ?
 *  [respectyoda](https://wordpress.org/support/users/respectyoda/)
 * (@respectyoda)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223753)
 * It’d be best to use `get_sidebar( 'left' );`.
 *  Thread Starter [Samar Hatem](https://wordpress.org/support/users/samar-hatem/)
 * (@samar-hatem)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223757)
 * Thanks a lot respectyoda
 *  [respectyoda](https://wordpress.org/support/users/respectyoda/)
 * (@respectyoda)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223761)
 * You are welcome! 🙂

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

The topic ‘Include functions’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [respectyoda](https://wordpress.org/support/users/respectyoda/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/include-functions/#post-5223761)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
