Skip to content

Instantly share code, notes, and snippets.

@SCRWD
Created May 14, 2010 21:34
Show Gist options
  • Select an option

  • Save SCRWD/401703 to your computer and use it in GitHub Desktop.

Select an option

Save SCRWD/401703 to your computer and use it in GitHub Desktop.
// jon.posterous.com
// adds current class to archives link
add_filter( "get_archives_link", "customarchives_link");
function customarchives_link( $x )
{
$url = preg_match('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.-]*(\?\S+)?)?)?)@i', $x, $matches);
return $matches[4] == $_SERVER['REQUEST_URI'] ? preg_replace('@<li@', '<li class="current_page_item"', $x) : $x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment