Looper offset

I’m sorry if this has already been answered but I can’t find it. Is it possible to use offset with a looper the way you can with the classic recent posts element?

I tried doing it with a query string but I may have done something wrong. I’m getting unexpected behavior when I try to use more than one parameter in a query string. What’s the correct syntax?

I’d like to start with the second most recent post.

1 Like

Thanks @Sheri17,

We should probably add Offset as a new option for Providers since that could be helpful for certain situations. Meanwhile, there are ways to do this using Consumers. Try this - and the element types are just examples - use whatever layout structure you want

  • Enable a Looper Provider on a Section
  • Add two rows each, with a single column
  • Enable Looper Consumer set to One on the first Row
  • Enable Looper Consumer set to All on the second Row
  • Drag a “The Title” element into the column of your second Row

You should see it looping but starting with the second post. This is because the first Row is consuming the first post and not doing anything with it. The idea here is you can make rich designs where post data is fed into any arrangement of elements with full control over the appearance and elements used. There’s also a performance advantage of not needing to run multiple queries like you would if you added multiple Classic Recent Posts elements.

Oddly, WordPress seems to have removed documentation on the query string method but here are some notes that might help: Feature Request: Query Builder - Author filter "Current Logged In User"

1 Like

Perfect. Your walk through helped me see exactly how it works.

I wanted to display the first post differently than the others. I left the section as the provider, as in your example, but then instead of making the rows consumers, I made the column of the first row a consumer of ONE and the column in the second row a consumer of ALL (i.e. all the rest). At that point I could put titles and whatever else I wanted about each post into the consumer columns. My columns in the second row repeat for each of my posts. I do love that it’s only one query and I can see now how there’s a lot of flexibility in this approach.

That got me exactly what I wanted. Thanks!

Ok perfect! I think the only downside to it not being an offset is that you can’t rely on the WordPress default for the number of items. If your default was 10, you’d only see 9. So you’d have to set your count to 11 in that case.