Ready to get started?Download WordPress


WP Grid Counter Custom Loop (2 posts)

  1. winnard
    Posted 9 months ago #

    Hi Guys,

    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');?>

    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!!!!



  2. vtxyzzy
    Posted 9 months ago #

    This article is not an exact match to your requirements, but it may help get you started: http://wordpress.mcdspot.com/2010/11/28/align-posts-in-a-row/


You must log in to post.

About this Topic