Modify archive loop to wrap every 4 posts in a bootstrap row?


I am making a custom post type archive, and what I am trying to do is make every 4 posts get wrapped in a bootstrap row.

For my CPT archive I just copied the default archive.php, renamed it, and copied the content template part and renamed that and called it as well. Right now in my content template part the posts are wrapped in a col-md-4 div. So the posts are falling into columns as they are supposed to, but since they are missing the row if one of the posts arent all the exact same hieght things don’t fall correctly.

I realize this is outside of the scope of support for your template, but was wondering if you could possible point me in the right direction. I’m not great at PHP. When I google the issue there are a few threads but they are all using custom queries. I just want to use the default _s loop you guys use in your theme.

Thanks for your help.

Hi @pierrebalian,

This falls out of support as you said, but I will try to help you. Could you send us your website link to check? I want to see exactly what you want to achieve and then I will send you some hints.