Show a different code on front page to other pages

You can use the wordpress template hierarchy to do just that. Specifically, you can put the code you want in front-page.php and then use index.php for the rest of them, though that’s a rather bland way of doing design with what you have on your hands.

Alternately, there are the wordpress conditional tags which can be used to detect whether you’re on a category page or the frontpage, etc.

Edit

Using the is_front_page() conditional:

<?php
if ( is_front_page() ) {
    // This is the site front page;
    // put your front-page output here
} else {
    // Put your default output here
}
?>