Add Class according to the order of appearance
Just create an array with your classes and loop through alongside with the main loop: function custom_top_products() { $classes = array( ‘first’, ‘second’, ‘third’, ‘fourth’, ‘fifth’ ); $classes_count = count( $classes ); $posts = new WP_Query( array( ‘post_type’ => ‘products’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘comment_count’, ‘posts_per_page’ => 5 ) ); $i = 0; ?><div … Read more