Opened 11 years ago
Last modified 7 years ago
#31960 new enhancement
Archives widget li should have informative css classes
| Reported by: | basteln3rk | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Widgets | Version: | 4.1.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | template |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
patch file to add classes for archive widget items