$totat_post = no. of post $per page: num of post to show
$inc = 0 ; if(($totat_post % $per_page) > 0){ $inc = 1; } $final_step = absint($totat_post/$per_page) + $inc; if($cur_step == $final_step){ //code }