自定义帖子类型存档:遍历任何现有子类别,然后显示其他自定义帖子类型条目

I have set up a standard Custom Post Type Archive page for the Custom Post Type 'Movies' with a standard Wordpress loop and set up my movie categories as follows and everything works.

SPECIAL EVENTS

    EVENT 1

    EVENT 2
    -- CHILD-EVENT CATEGORY 2.1
    -- CHILD-EVENT CATEGORY 2.2

    EVENT X
    -- CHILD-EVENT CATEGORY X.1
    -- CHILD-EVENT CATEGORY X.2

Now when I access for example the movie category 'EVENT 2' through the Custom Post Type Archive page (.../movies/special-events/event-2/) I like to loop through any existing child categories first (generic loop, not name dependent) and display these and then after that display all posts not assigned to any child category.

The child categories should be grouped so the output of the Custom Post Type Archive page (.../movies/special-events/event-2/) would like like this:


CHILD-EVENT CATEGORY 2.1 Name as 'h1' tag --> then list all posts assigned to this child category underneath ...

CHILD-EVENT CATEGORY 2.2 Name as 'h1' tag --> then list all posts assigned to this child category underneath...

Followed by all other posts not assigned to a child category


Any help would be greatly appreciated!