Multiple loop to show posts with a featured by using filterBy->num

Working on a custom tag that creates a loop to show all posts from a category. Want to have the first two posts in a different styling. Tried working with the FilterBy(‘num’, ‘<=’, 2) and that works for showing the first two posts. Then tried to create a second loop, and that’s where I fail in my thinking…

Below a snippet of the code

<?php

kirbytext::$tags['showposts'] = array(

'html' => function($tag) {

foreach(page('blog')->children()->visible()->filterBy('num', '<=', '2') as $project) {
 // styling the first two posts 
 };

 foreach(page('blog')->children()->visible()->filterBy('num', '>', '3') as $project) {
  // styling the rest of the posts
  };

  return $html;

}
);

The first loop works just fine and shows only the first two posts of ‘blog’.
But can’t seem to make the second loop work.

Looked at Show Once Per Page, Including Multiple Loops but I don’t want to use tags such as ‘featured’ or dates to display the posts. Thought the most easy way would be to use the filterBy(‘num’) option.

Anyone care to assist? Thank you in advance.

I’d use limit() and offset()

foreach(page('blog')->children()->visible()->limit(2) as $project) {
 // styling the first two posts 
 };

foreach(page('blog')->children()->visible()->offset(2)) as $project) {
  // styling the rest of the posts
  };