I’m trying to use L&L inside of a Category Archive page to pull the posts that are in that category. But I would also like to do a loop inside of that loop to pull any children taxonomy terms of the current archive and sort the posts into those categories on the page.
Example: Category Archive page = Restaurants
That taxonomy has Breakfast, Lunch, and Dinner sub categories.
I would like to display:
Breakfast:
list all the posts that are categorized as breakfast
Lunch:
list all the posts that are categorized as lunch
Dinner:
list all the posts that are categorized as dinner
Mainly, I’m struggling on how to pull just the current posts of the archive (ie Main Query) and not pull the full taxonomy
Just starting, trying to pull the current posts on this category archive page, this is what I have:
<Loop type=local_favorite taxonomy=local_category terms=current>
<Field title />
</Loop>
I’m guessing it should be terms=current, but that pulls nothing… And if I don’t include that, it just pulls all posts, not the ones on that category archive.
Just a thought, did you try to just loop without specifying the type, taxonomy and term?
Given the code is already in the Taxonomy Archive, it should get the main query data.
<Loop>
<Field title />
</Loop>
[Update] Just tested, it works for me in a Taxonomy Archive template (Beaver Themer)
Now that I have that working, my original question comes into play because this didn’t work. I can’t seem to pull the child taxonomies of the current taxonomy archive. I was hoping this would pull it - <Loop type=taxonomy_term> like this:
<Loop type=taxonomy_term>
<h2><Field title /></h2>
<Loop>
<Field title />
</Loop>
</Loop>
I made the same test, unfortunately, the nested loop returns all posts of the current Archive, no way to exclude/include posts having the parent or child term.