Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: tag_cloud_sort

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
616      if ( empty( $tags ) )
617           return;
618
619      // SQL cannot save you; this is a second (potentially different) sort on a subset of data.
620      if ( 'name' == $orderby )
621           uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') );
622      else
623           uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
624
625         $tags = apply_filters( 'tag_cloud_sort', $tags, $args );
626
627      if ( 'DESC' == $order )
628           $tags = array_reverse( $tags, true );
629      elseif ( 'RAND' == $order ) {
630           $keys = (array) array_rand( $tags, count( $tags ) );
631           $temp = array();
632           foreach ( $keys as $key )
633                $temp[$key] = $tags[$key];
634