My approach. No extra function, no filter. 🙂
<?php $GLOBALS['wpdb']->current_post = 0; ?>
<div <?php post_class( 0 === ++$GLOBALS['wpdb']->current_post % 3 ? 'third' : '' ); ?>>
Alternative:
<div <?php post_class( 0 === ++$GLOBALS['wpdb']->wpse_post_counter % 3 ? 'third' : '' ); ?>>
Related Posts:
- How to mark every 3rd post
- Count posts within a custom post type and specific taxonomy and terms?
- How to Display a List of Users Who Have Made at Least 1 Post?
- How to Display Network Post Count?
- How to cache a shortcode functions output?
- Count posts in category including child categories
- adding a custom css class to post
- Count singular post views automatically
- Set font size automatically according to number of words in post
- Network wide post count (WP Multisite)
- Odd/even class on article tag
- How to add padding between posts
- Redirect based on user post count
- Alternate custom content in the loop
- Show that current post is number X out of X
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Double count view in archive.php
- Count to how many categories a post belongs to
- Add Post Tags to Body Class
- Count total number across post types
- Count search results in heading
- How to hide first gallery for every post?
- Add a class to post title if a link ends with a certain extension
- Counter of posts ever posted – even deleted ones
- Display Published Posts Count for Certain Time Period
- How to make classes for posts?
- How can I get global $post to work for CPT and update user?
- Display Notification Bar on Header on Certain Post Count
- Show posts count for Categories and Tags in wp_nav_menu
- How to add category post count in main navigation menu [closed]
- Count number of posts of current month
- Add $values to post_class()
- Howto show comment count by post in post?
- Counter is skipping post when I still want it visible [closed]
- Every second post different class in blog view
- Count several post tags
- Get post number both in the loop and in the post
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Count the number of a post types associated with another post type
- How can I add a class to particular paragraphs in my post?
- Microformats in a single post – layout conflict
- Echo the number of posts being displayed
- wordpress add field to post_class
- Display amount of pending posts in back/front end
- Count user posts and store the number for later use
- why the posts queried from sql is more than those showed on the page?
- Count the total views of all user posts published
- Author post count in category
- Set post title font size automatically according to number of words in post title
- Show post count in custom taxonomy page
- Count singular post views automatically
- How to count posts in tags within time limit
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- Counting Posts by Category
- Display number of post published every day
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Alternative content between posts no repetition
- count_posts to a standalone link
- How to control Post view count incresing in sidebar widget posts too?
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How to limit the number of posts a user can publish based on user type
- ho can I get the number of the current post instead of the post id?
- post_count not working
- Adding Count Post in Page
- Count words for all posts by all authors
- Word count for all posts of all authors
- Display post count on archive page in reverse order
- How to get total posts count for each date?
- Comment count next to post title?
- WordPress is creating a lot of draft posts
- Grab next post title in archive page
- How do I control the fallback query after the original query returned cero posts?
- Checking if some condition is matched before inserting post into database
- Can’t seem to replicate permalink structure for localhost development site
- Newly created category does not show category
- Shortcode for printing post titles
- how to create cron that post events daily in wordpress?
- Show category post with excerpt text
- Post of a specific category – not to be seen in paging previous/next post
- $post->ID not working
- Authentication over CURL
- How to show main category related to that post
- WordPress rewrite url help needed
- How to Add Wrapper to Infinite Scroll Javascript?
- Permalink of some posts change
- Post not showing up sometimes on website
- Have latest post and recent posts display differently
- Removing a post from the results of a WP Query
- Extra field in wp_post instead of postmeta
- 3rd Party Login in wordpress
- Same sidebar in all posts as in the category
- Add wp-link-pages to post
- Voting System, database connections?
- Adding The Post Template Dropdown to WP-Admin
- Fixing my display pending posts
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- wordpress paginate, link to the right page
- Posts page template: How can I edit the markup for this?
- 2nd post different layout
- Print all content of a paged post