I know I can use wp_list_categories()
to list categories, but how can I achieve to list also the posts under the respective categories, below an example what I want to achieve:
- category1
- -- post under cat1
- -- post under cat1
- -- post under cat1
- category2
- -- post under cat2
- -- post under cat2
- -- post under cat2
get_categories()
so you don't have to fight with the formatting. developer.wordpress.org/reference/functions/get_categories