I created a custom post type: "Rooms & Suites", with taxonomy "Room types". I have 3 Room types (A,B and C). Each Room Type can have many rooms. Finaly I need to show all the rooms, in the archive page of post type "Rooms & Suites" like this:
Room Type A
room 1
room 2
...
Room Type B
room 1
...
Room Type C
room 1
...
I think the above functionality refers to the "nested views". So can the Archive page of Rooms & Suites be formated this way?
It's not possible to group a WordPress Archive of posts by taxonomy term directly in the loop, but you could insert nested Views in a WordPress Archive to achieve something similar. Leave the wpv-loop tags in the WordPress Archive empty. Insert the parent View of terms just before the wpv-loop tags. Insert the child View of posts in the parent View of terms, inside the wpv-loop tags.
There are several limitations with this approach. For example, filters, pagination and post counts may not work as expected in the WordPress Archive or in the nested Views. This approach works best in the simplest cases. More complex cases will require more complex custom code.
Thank you Christian.
This is what I tried so far, but I would like to know if it was my best option or I was missing anything.
The limitations are not problem for me so this solution is ok. Finally, although I leave the loop empty, it is excecuted for every custom post type of the taxonomy. If I had 1000 records, would that be heavy or it has minor impact on server resources?
If I had 1000 records, would that be heavy or it has minor impact on server resources?
I don't think it would be a problem, but unless you're using custom code, the maximum number of results shown on one page of an archive is 50. If you're concerned about performance, use the Pagination settings on the WordPress Archive to limit the number of results to a maximum of 1. This way the loop is only executed a maximum of once for each page of results. If you cannot see the Pagination settings in the WordPress Archive editor, scroll up to the top right corner and click Screen Options.
My issue is resolved now. Thank you!