Automatically creating a custom CSS class for every sixth post
-
I am getting to grips with PHP coding and WordPress. So far so good but have been stuck in a rut at the moment and would appreciate any help.
I am looking to specifically add a new class to each sixth post in the following ‘loop’.
<?php if (have_posts(is_category('3'))) : query_posts('orderby=title&order=ASC&posts_per_page=-1'); while (have_posts()) : the_post(); ?> <div></div> <?php endwhile; else: ?> <?php endif; ?>As it stands, it does a great job of checking if there are any posts and then only bringing up all the posts under a certain category and orders them alphabetically. However I want to add the new class so that every sixth post is targeted with extra lines of CSS to make it fit my design.
Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Automatically creating a custom CSS class for every sixth post’ is closed to new replies.