Display Full Content Of The Most Recent Post and Others With Excerpts

We’ll use a WordPress loop to do this. First, we need to add a variable $count which will count how many posts are listed.

Paste the below codes in the current loop. You can change $postnumber variable to set the maximum posts should be showed.

1
2
3
4
5
6
7
8
9
10
11
<?php
    $postnumber = 5; //maximum number of posts to show
    if(have_posts()) : $count = 0;
        while (have_posts()) : the_post();
            $count++;
            if ($count < $postnumber) : the_content();
            else : the_excerpt();
            endif;
        endwhile;
    endif;
?>
<?php
	$postnumber = 5; //maximum number of posts to show
	if(have_posts()) : $count = 0;
		while (have_posts()) : the_post();
			$count++;
			if ($count < $postnumber) : the_content();
			else : the_excerpt();
			endif;
		endwhile;
	endif;
?>