Opened 9 years ago
Last modified 5 years ago
#31960 new enhancement
Archives widget li should have informative css classes
Reported by: | basteln3rk | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1.1 |
Component: | Widgets | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
The archives widget should add classes m-item
and m-item-XXXX
to allow better styling and ajax functionality, as well as being consistent with other widgets (e.g. categories widget provides such classes as cat-item
and cat-item-XX
with ID).
Workaround: it is possible to customize the archive link getter to add the required css classes:
add_filter( 'get_archives_link', function($link_html) {
preg_match('/m=([0-9]+)/', $link_html, $m);
$month= $m[1];
if ($month) {
return preg_replace('/<li>/', '<li class="m-item m-item-' . $month . '">', $link_html);
}
else {
return $link_html;
}
});
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
patch file to add classes for archive widget items