Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $books = get_terms( 'book_titles', array( 'orderby' => 'name' ) );
- $previous_letter = false;
- foreach ( $books as $book ) {
- // If the first letter is not the same as the previous book,
- // then start a new section.
- $letter = substr( $term->slug, 0, 1 );
- if ( $previous_letter != $letter ) {
- $previous_letter = $letter;
- echo "Here's all of the letter " . strtoupper( $letter ) . ' books:<br />';
- }
- echo "{$term->name}<br />";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement