Created
September 17, 2013 14:19
-
-
Save aaroneaton/6594944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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