[wp-trac] [WordPress Trac] #31960: Archives widget li should have informative css classes

WordPress Trac noreply at wordpress.org
Mon Apr 13 13:27:53 UTC 2015


#31960: Archives widget li should have informative css classes
-------------------------+-----------------------------
 Reporter:  basteln3rk   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Widgets      |    Version:  4.1.1
 Severity:  normal       |   Keywords:
  Focuses:  template     |
-------------------------+-----------------------------
 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:

 {{{#!php
 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;
         }
 });
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31960>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list