It is necessary to order the elements from the mixed order. Ordering is done using the recursion method. Two conditions must be met that while are not implemented in the code:>
This is a change to your root template. Your other templates stay the same. Hopefully, this will help.