Display Posts Shortcode
[resolved] Adding Column Classes Functions Not Working (3 posts)

  1. osseonews
    Posted 2 years ago #

    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/ 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?


  2. Bill Erickson
    Plugin Author

    Posted 2 years ago #

    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.

  3. osseonews
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Display Posts Shortcode
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.