The following code is in case you need to display a snippet of code only on the main page and certain pages of your blog.
<?php wp_reset_query(); ?> <?php if(is_home() || is_front_page() || is_page( 12) || is_page( 150)): ?> Put your code in here... <?php else: ?> Put another code in here... <?php endif; ?>
Read the complete WP Conditional Tags here.