• Resolved tecladigital

    (@tecladigital)


    Hi!

    I want to create a grid with the latest posts. With three posts per row.

    Is there a code example to get a loop with, for example, count=9 but with 3 items per row?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks for reaching out!

    Since you’re mentioning the count parameter, I assume you already know how to create a loop for your content, but if I’m understanding correctly you’re now wondering how to make the content from that loop appear in three columns, is that right?

    If so, I have bad news and good news. The bad news is that there’s not (currently) a simple parameter that automatically places content into neat columns. That might be added in the future, but I don’t believe it’s on the short-term roadmap.

    The good news is that since L&L is just an extension of HTML, there’s no need to reinvent the wheel since you can easily use standard CSS solutions to style your content, probably either using flexbox or CSS grid. Those aren’t L&L-specific so you’ll find plenty of resources online about how to work with that if you’re not already familiar. There are also generators available online (like this one for CSS grid and this one for flexbox) if you’d rather go that route. The CSS can be easily added to the Styles tab of your template or to your site’s global styles, whatever fits your workflow best.

    So in the end, the markup you’d write in your template would end up looking something like this with a my-post-grid CSS class (or whatever you decide to call it) that’s styling your content into three columns:

    <div class="my-post-grid">
      <Loop type=post count=9>
          Here's where you'd add some dynamic tags indicating what content you want to display like <Field title /> along with standard HTML tags to structure your post grid.
      </Loop>
    </div>

    I hope that gets you going in the right direction! We’re working on putting together more L&L markup examples to add to the documentation but in the meantime, you might find some of the posts on our blog useful as you’re learning the L&L ropes.

    While I’m at it, I thought I’d mention that you might find the Loops & Logic forum to be a better place to get product support in the future. It’s a much more active community than this support in the WordPress plugin repository.

    Thread Starter tecladigital

    (@tecladigital)

    Thank you for your reply.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘loop with 3 itens per row’ is closed to new replies.