A-Z index list of category
-
How to make an alphabetical list of category??
i want someting like what
list of letter with link A
A category list
Art
Artist
Arc
ArmB category list
C category listi find this code but is for tags
<?php $list = ''; $tags = get_terms('post_tag' ); $groups = array(); if( $tags && is_array( $tags ) ) { foreach( $tags as $tag ) { $first_letter = strtoupper( $tag->name[0] ); $groups[ $first_letter ][] = $tag; } if( !empty( $groups ) ) {{ $index_row .='<ul class="topindex">'; foreach ($groups as $letter => $tags) { $index_row .= '<li><h4><a href="#' . $letter . '" title="' . $letter . '">' . apply_filters( 'the_title', $letter ) . '</a></h4></li>'; } $index_row .='</ul><br class="clear" />';} $list .= '<ul class="index">'; foreach( $groups as $letter => $tags ) { $list .= '<li><a name="' . $letter . '"></a><h5><a href="#tags_top" title="back to top">' . apply_filters( 'the_title', $letter ) . '</a></h5>'; $list .= '<ul class="links">'; foreach( $tags as $tag ) { $url = attribute_escape( get_tag_link( $tag->term_id ) ); $name = apply_filters( 'the_title', $tag->name ); $list .= '<li><a title="' . $name . '" href="' . $url . '">' . $name . '</a></li>'; } $list .= '</ul></li>'; } $list .= '</ul>'; } }else $list .= '<p>Sorry, but no tags were found</p>'; ?> <a name="tags_top"></a> <?php print $index_row; ?> <?php print $list; ?>
ul.topindex, .topindex li {display:inline;float:left;padding-right:5px}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘A-Z index list of category’ is closed to new replies.