Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. // Display of categories with this first letter
  2. $categories = get_categories();
  3. foreach ($categories as $cat) {
  4.     $thecats[strtoupper(substr($cat, 0, 1))] = $cat;
  5. }
  6. if ($thecats) echo '<ul>';
  7. for ($i=65; $i< =90; $i++) {
  8.     $x = chr($i);
  9.     if ($thecats[$x]) {
  10.         echo '<li>' . $x . '<ul>';
  11.         foreach ($thecats[$x] as $c) {
  12.             '<li><a href="' . get_category_link($c->term_id) . '">' . $c->name . '</a></li>';      
  13.         }
  14.         echo '</ul></li>';
  15.     }
  16. }
  17. if ($thecats) echo '</ul>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement