Display just one post from a loop of 5 posts?

Solved the problem by inserting this: <?php if (in_array($counter, array(0)) ) :?> // show content <?php $counter++; endif;?> The above basically displays only 1 post that is first in the array. In case anyone needs to solve a problem like this.

Create an array with all the links of the years’ archive (of a custom post type)

I just recieved this answer in the StackOF page and it worked, though I don’t fully understand it. $links = wp_get_archives(array(‘echo’=>’0′,’format’=>'<link>’)); $regex = ‘/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i’; preg_match_all($regex, $links, $matches); $array_links = $matches[0]; print_r($array_links); Just added ‘post_type’ => ‘myCPT’ in the wp_get_archives() array and it worked. Get to the real answer: https://stackoverflow.com/a/69365466/16825540