function pc_theme_get_archives_link ( $link_html ) {
global $wp;
static $current_url;
if ( empty( $current_url ) ) {
$current_url = add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) );
}
if ( stristr( $link_html, $current_url ) !== false ) {
$link_html = preg_replace( '/(<[^\s>]+)/', '\1 class="active"', $link_html, 1 );
}
return $link_html;
}
add_filter('get_archives_link', 'pc_theme_get_archives_link');
No comments:
Post a Comment