Skip to content

Instantly share code, notes, and snippets.

@joehoyle
Last active October 12, 2015 14:27
Show Gist options
  • Save joehoyle/4040311 to your computer and use it in GitHub Desktop.
Save joehoyle/4040311 to your computer and use it in GitHub Desktop.
<?php
hm_rewrite_rule( array(
'regex' => '^users/([^/]+)/?',
'query' => 'author_name=$matches[1]&',
'template' => 'user-archive.php',
'body_class_callback' => function( $classes ) {
$classes[] = 'user-archive';
$classes[] = 'user-' . get_query_var( 'author_name' );
return $classes;
},
'title_callback' => function( $title, $seperator ) {
return get_query_var( 'author_name' ) . ' ' . $seperator . ' ' . $title;
}
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment