Creating a Column Based WP Post Loop


Modifying the index.php file to display posts, I need a split the loop into two columns. Creating the HTML with inline CSS is easy and done, but I do not know nor do I understand how to create the argument for "post 1-4 to the left, post 5-8 to the right".

HTML code:

<div style="width:40%;padding:0 10px 0 0;float:left;">
1-4, 9-12 etc based on pagination

<div style="width:40%;padding:0 10px 0 0;float:right;">
5-8, 13-16 etc based on pagination
<div style="clear:both;"></div>

If someone can help me understand and help me make this, I would be very grateful.

Sofia Herrmann 2 years 2020-12-24T03:10:57-05:00 0 Answers 5 views 0

Leave an answer