• I have a kind of tag cloud box that displays all linked tags from the current set of posts.

    I can’t figure out how to sort the tags in ascending alphanumeric order. The tags are all jumbled together without any apparent organization.

    Can anyone help? Here’s the code:

    <ol id="tagsSubNav"><li>Sort by Type:</li><?php
    		query_posts('category_name=retail&showposts=-1&orderby=title&order=asc');
    		if (have_posts()) : while (have_posts()) : the_post();
    		   $posttags = get_the_tags();
    			if ($posttags) {
    				foreach($posttags as $tag) {
    					$all_tags_arr[] = $tag -> name; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique
    				}
    			}
    		endwhile; endif; 
    
    		$tags_arr = array_unique($all_tags_arr); //REMOVES DUPLICATES
    		//echo '<pre>'.print_r($tags_arr, true).'</pre>';
    
    		  foreach ($tags_arr as $tag) {
    			 echo '<li><a href="/tag/'.$tag.'">'.$tag.'</a></li>';
    		  }
    
    		?></ol>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Tag Cloud Does Not Display in Ascending Alphanumeric Order’ is closed to new replies.