This code enables you to add the same class to every odd number of posts and another class to every even numbered post, on any type of archive.
The code also works in any theme.
You can use the code on your:
- front page
- home page
- blog page
- taxonomy or term archive
- or any type of archive page including category, tag, date, author and custom post type archives
The code also enables you to control which pages the classes are added to for paginated archive pages. This means you can use the code to add classes only on the first, second and/or third page etc of any type of archive page.
Here’s the code for logged in members:
Was This Tutorial Helpful?