I am currently working on my
home.php file for my theme, and I'm planning on displaying my the last Blog posts in a "grid view", so that there are 4 containers in a row, containing the title and some more information.
I tried out some things, but nothing worked the way I wanted it to. The last thing I did was putting a for loop like this:
<?php for ($x = 1; $x <= 6; $x++) : ?> <div id="home_post_<?php echo $x ?> " class="home_post"> <?php if(have_posts()) : while(have_posts()) : the_post(); get_template_part('template-parts/content', 'home'); endwhile; endif; ?> </div> <?php endfor; ?>
Around my loop, but that way, every new
div is filled with the first overall Blogpost, so this is not the way to do it.
Is there a clever way to work with a loop that "generates" divs or am I just on the wrong track?