Skip to content

Instantly share code, notes, and snippets.

@aaroneaton
Created September 17, 2013 14:19
Show Gist options
  • Save aaroneaton/6594944 to your computer and use it in GitHub Desktop.
Save aaroneaton/6594944 to your computer and use it in GitHub Desktop.
<?php
$last_char = null;
foreach( $documents as $document ) {
// Gets the first character of the post title
$this_char = strtoupper( substr( $document->post_title, 0, 1 ) );
// If this character is different than the last, insert the seperator with anchor
if ( $this_char != $last_char ) {
$last_char = $this_char;
echo '<a name="' . $last_char . '"></a>';
echo '<h3 class="doc-seperator">' . $last_char . '</h3>';
}
//
get_template_part( 'document', 'single' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment