Title: Adding Column Classes Functions Not Working
Last modified: August 20, 2016

---

# Adding Column Classes Functions Not Working

 *  Resolved [osseonews](https://wordpress.org/support/users/osseonews/)
 * (@osseonews)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/adding-column-classes-functions-not-working/)
 * Hi there,
    I wanted to split the results into columns. I have see your code here:
   [http://www.billerickson.net/code/add-column-classes-to-display-posts-shortcodes/](http://www.billerickson.net/code/add-column-classes-to-display-posts-shortcodes/)
   and I am using Genesis, so I have the correct style sheet. However, your code
   doesn’t seem to work, as each listing simply adds “first” to every div class (
   the div class becomes: <div class=”listing-item one-third first”>), so that each
   listing is cleared (clear:both). For some reason your if statement: if( 0 == 
   $listing->current_post || 0 == $listing->current_post % 3 ) $classes[] = ‘first’;
 * Always returns true and adds first to ever div class in the list.
 * Any ideas what’s going here?
 * [http://wordpress.org/extend/plugins/display-posts-shortcode/](http://wordpress.org/extend/plugins/display-posts-shortcode/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Bill Erickson](https://wordpress.org/support/users/billerickson/)
 * (@billerickson)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/adding-column-classes-functions-not-working/#post-3298960)
 * Sorry, there was a typo in the snippet. At the top where the function is being
   defined, the third parameter should have been $listing, not $query. I’ve updated
   the snippet and tested to confirm it works.
 *  Thread Starter [osseonews](https://wordpress.org/support/users/osseonews/)
 * (@osseonews)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/adding-column-classes-functions-not-working/#post-3298972)
 * OK. Thanks very much for the quick reply. What I actually did in the interim 
   was surround each call of the shortcode with a specific CSS div, and then used
   CSS to control the display. Much easier with the PHP, though and I can loop thru
   more data. Thanks for the great plugin.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding Column Classes Functions Not Working’ is closed to new replies.

 * ![](https://ps.w.org/display-posts-shortcode/assets/icon-256x256.jpg?rev=2940963)
 * [Display Posts - Easy lists, grids, navigation, and more](https://wordpress.org/plugins/display-posts-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/display-posts-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/display-posts-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/display-posts-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/display-posts-shortcode/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [osseonews](https://wordpress.org/support/users/osseonews/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/adding-column-classes-functions-not-working/#post-3298972)
 * Status: resolved