I am trying to create a grid loop for my portfolio section on my website.
I don’t want to use a plugin!
I want to display the portfolio listings in four (‘threecol’) columns.
On the 4th column in the row I need to add a CSS class of “.last”
Currently I have the following code.
<div class="row"> <div class="container"> <div class="full-width" role="main"> //Here is where I would like to place the code. <div class="threecol <?php // if it is the fourth in the row add class LAST to it?> "> <?php get_template_part('loop');?> </div> </div> </div> </div>
Hope this makes sense. I want to simply wrap each post in a class with threecol. On the fourth one (Or last in the row) add an additional class of last and start a new row and repeat as required.
Its really bugging me, I have found code snippets that give me the jist but can’t edit them to my needs, or the loop doesn’t close and it repeats over and over. HELP!!!!
- The topic ‘WP Grid Counter Custom Loop’ is closed to new replies.