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!
review:
http://codex.wordpress.org/Function_Reference/get_sidebar
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.
review:
http://codex.wordpress.org/Function_Reference/get_sidebar
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.
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'); ?
It’d be best to use get_sidebar( 'left' );.