I'm blown away by Themeatic and have managed to overcome many challenges as a cutter-paster but have hit a wall trying to add a class name to posts similar to "alt" but that starts over for each new year. In other words I need to add a class to the 2nd, 4th, etc. post of each year, rather than for all posts in a page.
I've been trying to modify thematic_post_class, specifically this part:
// If it's the other to the every, then add 'alt' class
if ( ++$thematic_post_alt % 2 )
$c[] = 'alt';
Within a childtheme_override_post_class() function in my child functions.php, I have the following conditional:
if (is_category('7')){
$currentyr = mysql2date('y', $post->post_date, false);
if ($currentyr != $previousyr) {
if ( $thematic_post_alt % 2 ){
$c[] = 'alt';
}
$previousyr = $currentyr;
}
++$thematic_post_alt;
} else {
// If it's the other to the every, then add 'alt' class
if ( ++$thematic_post_alt % 2 )
$c[] = 'alt';
}
I used the above "if ($currentyr != $previousyr) {" conditional in my child category loop successfully to echo line breaks for new years, but can't seem to resolve it in the thematic_post_class function.
I've tried re-declaring $thematic_post_alt = 1; every time there's a new year, but that just gives me a post ID of 1 across the board…any assistance is greatly appreciated!