Try this (untested):
<?php $zebra = (++$j % 2 == 0) ? 'evenpost' : 'oddpost'; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix span4 ' . $zebra); ?> role="article">
You just need to place theodd/even class into a variable before passing it to post_class.
Related Posts:
- How to mark every 3rd post
- adding a custom css class to post
- How to add padding between posts
- Add Post Tags to Body Class
- Add a class to post title if a link ends with a certain extension
- How to make classes for posts?
- Add $values to post_class()
- Every second post different class in blog view
- How can I add a class to particular paragraphs in my post?
- Microformats in a single post – layout conflict
- wordpress add field to post_class
- How to mark every 3rd post
- Where is the old post permalink slug stored?
- Keyboard shortcut for updating a page or post?
- How to Change Order of Posts in Admin?
- How to Display Network Post Count?
- How to disable content pagination?
- Manipulate post category after time
- Categories box not showing on post edit pages
- Exclude ALL posts from sub categories
- how to enable different number of revisions for different blogs when using WPMU?
- Removing the title attribute from links in the post content
- Show a list of recently viewed posts to a user
- Possible to create a permalink to sort with meta_key?
- Single Post Gallery Using Shortcode
- Get how many days since last post of the current user
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- Does WP get all post_meta on POST page?
- Posting via email, where do I start troubleshooting?
- Does an action fire when adding a tag via the “Tags” meta box?
- how load content as pop-up using ajax
- UberMenu list current user’s posts as menu items
- Improving WP_Query for performance when random posts are ordered
- How to make the post summary taller?
- Why content_arr[‘extended’] removes paragraph tags?
- How To Get Posts With A Specific Word
- Getting index.php instead single.php for displaying posts
- Changing Permalinks for Default Post type to reflect navigation
- How to prevent duplicate posts with wp_insert_post on single.php?
- problems with loading posts in a table-row
- It is possible to add extra button under the ‘publish’ button in the post of wordpress? and how?
- How to have posts have a parent in permalink like site.com/blog/postname
- Second comments section for one post/page
- 404 error on default post type and default taxonomy fronted page
- How i can limit period of post publication?
- Internal post link creates comments on its own
- Can’t set Post ID properly
- Display post changelog in post
- Why Query is returning empty array?
- Change post-slug using wordpress API? Change permalink of a post using php / jquery?
- meta_value timestamp older than now
- How to create a second posts page which client can update
- Form to post new post with custom taxonomies
- All Posts Linking to Author Posts directly
- Total number of posts in query (category/tag/author/search results/main page…)
- search blog posts by author first name and or last name
- Make loop inside slider divisible [closed]
- How to add convenient buttons for new custom post statuses
- Change the number of excerpts displayed in search results layout
- Database hacked – random posts are modified
- Display value of custom field at the beginning of a post
- How to display post list in a table layout (multiple queries in single loop)
- add div after image in post [closed]
- Get current post’s nav menu name (term name)
- Get latest author posts inside the loop
- Post is in descendant category not working in home.php
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- Get content from WordPress posts in Boostrap modal window – Javascript side?
- How can my plugin display a populated new post window
- Approve modified posts
- How to repeat a loop after 4 posts [duplicate]
- How to show beneath posts the full category path?
- User friendly news section in WordPress without using posts
- How to assign a post to a post parrent?
- Bulk update published posts date randomly using wp-cli?
- How to insert custom text after H1 to all my blog posts?
- SQL query: select duplicate posts – but using duplicate meta [duplicate]
- Sync All Post Type Tag
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- WordPress URL question
- issue in wordpress auto delete post and redirect to another 1
- Custom fields in normal posts
- Modify WordPress loop after it has been run
- How to get next_posts_link working with a customised page
- Ordering posts alphabetically by meta keys and title
- Loop doesn’t display posts. It displays a link to the home page instead
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Super post cleaner, could this be category specific?
- WordPress Post Grid
- Why I getting only 1 post?
- Get current post’s child page?
- Choose options via url
- Custom Post Type Pagination 404 Error (if paged>=2) [duplicate]
- Show all posts in category
- Creating a new Sortable Column in WordPress Admin
- Display post structure in function
- What function does the loop of displaying posts?
- How to use shortcode to get the second to newest post?