I hadn’t tried this in practice, but theoretically should be easy.
-
post_parent
argument in query set to0
should limit it to parent items, see Post & Page Parameters. -
Use
pre_get_posts
hook to correctly adjust main query, adding that argument.
I hadn’t tried this in practice, but theoretically should be easy.
post_parent
argument in query set to 0
should limit it to parent items, see Post & Page Parameters.
Use pre_get_posts
hook to correctly adjust main query, adding that argument.