Home » Wordpress » How Separate First post from Other in wordpress loop

As wordpress freelancer i found way to first post from Other in wordpress loop. Below is php code for same.

$latest_post = new WP_Query("post_type=post&posts_per_page=5&orderby=date&order=DESC");
if ( $latest_post->have_posts() ) :  $i = 0; while ( $latest_post->have_posts() ) : $latest_post->the_post();
if ( $i == 0 ) { ?>
<!-- FIRST POST CODE WILL COME HERE -->
<?php }else{ ?>
<!-- Others POST CODE WILL COME HERE -->
<?php }  
$i++;  
endwhile;  
endif; 

Array ( [0] => Wordpress )