Using Plugin with Alternating Post Classes
-
I’m using the code below in my theme to change the background color for alternating posts and it’s working for the posts that are already shown, however it’s not working in conjunction with the Load More plugin. Any suggestions?
<?php
// Add ‘odd’ and ‘even’ post classes
function alternating_post_class ( $classes ) {
global $current_class;
if( is_home() ):
$classes[] = $current_class;
$current_class = ($current_class == ‘odd’) ? ‘even’ : ‘odd’;
endif;
return $classes;
}
add_filter (‘post_class’, ‘alternating_post_class’);
global $current_class;
$current_class = ‘odd’;
?>
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Using Plugin with Alternating Post Classes’ is closed to new replies.