New recommended syntax for post loops in L&L 3.2.3

In addition to improving compatibility with yesterday’s WordPress 6.2.1 security update and introducing a handful of other improvements, the latest version of L&L includes a new post_type query parameter that allows you to refer to a custom post type even when there’s a loop type by the same name in L&L. This will be the new recommended syntax for post loops. Check out the linked part of the post below for the full explanation.

If you’re short on time, the basic idea is that looping through a custom post type has generally looked like this in the past:

<Loop type=my_custom_post_type>

I haven’t heard of anyone running into issues with this syntax, but there’s a small potential that if someone had a post type that shared the same name as one of L&L’s loop types (like a CPT called taxonomy_term or user ), they wouldn’t be able to loop through that CPT. To avoid this conflict before it even happens, L&L 3.2.3 introduces a new query parameter for referring to post types:

<Loop type=post post_type=my_custom_post_type>

Just like many of the other loop types in L&L, there’s also a quick shorthand syntax that can be used if you want to avoid repetition and keep your templates short:

<Loop post_type=my_custom_post_type>
6 Likes