Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Print an alphabetical list of category links for a post
- $id = $post->ID;
- $category = 'directorycategory';
- $terms = get_the_term_list( $id, $category, '', '||', '' );
- $term_array = explode('||', $terms);
- $keyed_array = array();
- foreach ($term_array as $term) {
- // Get the term name
- if ( preg_match('/>([^<]*)<\/a>/', $term, $matches) ) {
- $keyed_array[strtoupper($matches[1])] = $term;
- }
- }
- ksort($keyed_array);
- echo '<div class="specialties">';
- $sep = ' ';
- foreach ( array_keys($keyed_array) as $key) {
- echo "$sep$keyed_array[$key]";
- $sep = ', ';
- }
- echo '</div>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement