I call wp_get_archives in a sidebar, using the defaults so it displays archives listed by month. I want to highlight the month in the list when you are on that month’s archive page.
This would be similar to the logic with
wp_list_categorieswhen the category list is generated on a Category Archive page, and how the list item for that category is marked with the HTML class current-cat.
I know the XHTML/CSS involved (i.e., I know how to style the markup to get that affect) – but I CANNOT figure out how to coerce WordPress to generate the necessary class attribute for me to use as a style hook.
I need something like this:
<ul id="archives"> <li class="selected"><a href="#" title="April 2008">April 2008</a></li> <li><a href="#" title="March 2008">March 2008</a></li> <li><a href="#" title="Feb 2008">Feb 2008</a></li> ... </ul>
How do I get wp_get_archives to generate a class attribute for the selected archive month?
- The topic ‘Modify wp_get_archives | highlight current archive category’ is closed to new replies.