While integrating a WP theme many times we come across a situation where we have a code which is being used at few other templates. The best way is keep that code in a separate php file (blog-sidebar.php) and include it to those pages. For example we have blog custom template and we want its side bar to be displayed at blog template and also at single post template as well. Here is the wordpress code to do it.
<?php get_template_part('blog-sidebar'); ?>