Add a current month class to the archive widget.
<?php
/**
* Add a current month class to the archive widget.
*/
add_filter('get_archives_link', function($link_html) {
if (is_month()) {
$current_month = get_the_date("F Y");
if (strpos($link_html, $current_month) !== false) {
$link_html = preg_replace('/<li>/i', '<li class="current-month">', $link_html, 1);
}
}
return $link_html;
});
?>
functions.php