Using L&L Inside a Category Archive

Thanks for taking a look. I updated and tried your suggestion, but it’s only outputting the taxonomy:
Screen Shot 2022-04-27 at 12.57.23

This was the closest I got before: Using L&L Inside a Category Archive - #18 by zack

I see, so <Loop field=posts> is not working as expected. Hmm, I wonder why that’s empty…

Just to clarify, in this expected result:

Breakfast

  • place 1
  • place 2

Do the posts “place 1” and “place 2” have the child term called “Breakfast”, or do they only have the parent term “Restaurants”?

Yes, that is the correct expected result.

Breakfast

  • place 1
  • place 2

Lunch

  • place 3
  • place 4

Dinner

  • place 5
  • place 6

And each of those have the child term (so place 1 has Breakfast as a term)

One thing that could have a difference is that I have removed the parent term from each, so none of them have Restaurant as a parent term. They only have the child term.

Oh, I forgot to mention, the field=posts is a newly added feature in the latest plugin version 2.4.1. Could you check and update the plugin if necessary?

EDIT: Oops, never mind, I see you did update the plugin. OK, I’ll dig deeper and see if I can figure out why it’s not working as excepted.

Hi Zack,

I figured out that Loop field=posts was getting posts belonging to a child term, but only from the post type post. In the newest plugin version, this has been changed so it gets posts from any post type.

So the following should work now:

<Loop field=archive_term>
  <Loop field=children>
    <h2><Field title /></h2>
    <Loop field=posts>
      - <Field title /><br>
    </Loop>
  </Loop>
</Loop>

I made other improvements related to taxonomy query, taxonomy term loop, and better support for taxonomy archive page.

That includes terms=current for the post loop, which you tried before. It should work now too:

<Loop type=local_favorite taxonomy=local_category terms=current>
  <Field title />
</Loop>

Wonderful. That worked :raised_hands:t2: Thank you for working on that!

1 Like