Creating a “glossary” of WordPress posts of a specific post type
Declare a $previous_letter variable, and at the end of the foreach give it the value of the current $glossary_letter. Before of show the $glossary_letter make an if condition. If $glossary_letter is different to the $previous_letter then show it. $previous_letter = null; foreach ( $postslist as $post ) : setup_postdata( $post ); $glossary_title = get_post_custom_values($key = … Read more