I am currently using this little loop to display a list of posts using the "events" custom post type
<?php global $post; // required $args = array('post_type' => 'events'); $custom_posts = get_posts($args); foreach($custom_posts as $post) : setup_postdata($post); ?> <ul><li class="post">Content goes here</li></ul> <?php endforeach; ?>
What I want to do is add a class to every other list item so that I can style them alternatively (One white, one black, one white, one black, for example)
I've done this before with a standard loop but I'm only just converting over to get_posts so I'm a bit stuck.
Any help would be great.
Thanks in advance