Remember that other post that added the <div class="clear"></div>
? That code in the portfolio file adds it after every 4 posts. So change it from 4 to 3 like this –
Change
// Assumes 4 posts per row
$end_row = ( $wp_query->current_post + 1 ) / 4;
To this –
// Assumes 3 posts per row
$end_row = ( $wp_query->current_post + 1 ) / 3;