Skip to content

Instantly share code, notes, and snippets.

@nickkoskowski
Created November 12, 2015 23:26
Show Gist options
  • Select an option

  • Save nickkoskowski/4c2ee36a61e6719b5189 to your computer and use it in GitHub Desktop.

Select an option

Save nickkoskowski/4c2ee36a61e6719b5189 to your computer and use it in GitHub Desktop.
Alphabetical Tabs
<?php
$user_query = get_users($args = array('orderby' => 'first_name','order' => 'ASC' ));
$i = 0;
foreach ($user_query as $user) {
if (substr($user_query[$i - 1]->first_name, 0, 1) != substr($user->first_name, 0, 1)) {
echo '<span class="lettering">'.substr($user->first_name, 0, 1).'</span>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment