Be seen. Boost your question’s priority for more expert views and faster solutions
array(5) {
[552]=>
object(stdClass)#170 (10) {
["term_id"]=>
string(3) "552"
["name"]=>
string(5) "life"
["slug"]=>
string(5) "life"
["term_group"]=>
string(1) "0"
["term_taxonomy_id"]=>
string(3) "555"
["taxonomy"]=>
string(8) "post_tag"
["description"]=>
string(0) ""
["parent"]=>
string(1) "0"
["count"]=>
string(1) "1"
["object_id"]=>
string(4) "1931"
}
[551]=>
object(stdClass)#169 (10) {
["term_id"]=>
string(3) "551"
["name"]=>
string(6) "Sally"
["slug"]=>
string(6) "sally"
["term_group"]=>
string(1) "0"
["term_taxonomy_id"]=>
string(3) "554"
["taxonomy"]=>
string(8) "post_tag"
["description"]=>
string(0) ""
["parent"]=>
string(1) "0"
["count"]=>
string(1) "1"
["object_id"]=>
string(4) "1931"
}
[550]=>
object(stdClass)#167 (10) {
["term_id"]=>
string(3) "550"
["name"]=>
string(4) "John"
["slug"]=>
string(4) "john"
["term_group"]=>
string(1) "0"
["term_taxonomy_id"]=>
string(3) "553"
["taxonomy"]=>
string(8) "post_tag"
["description"]=>
string(0) ""
["parent"]=>
string(1) "0"
["count"]=>
string(1) "1"
["object_id"]=>
string(4) "1931"
}
[554]=>
object(stdClass)#166 (10) {
["term_id"]=>
string(3) "554"
["name"]=>
string(13) "food"
["slug"]=>
string(13) "food"
["term_group"]=>
string(1) "0"
["term_taxonomy_id"]=>
string(3) "557"
["taxonomy"]=>
string(8) "post_tag"
["description"]=>
string(0) ""
["parent"]=>
string(1) "0"
["count"]=>
string(1) "1"
["object_id"]=>
string(4) "1931"
}
[553]=>
object(stdClass)#165 (10) {
["term_id"]=>
string(3) "553"
["name"]=>
string(7) "Life"
["slug"]=>
string(7) "life"
["term_group"]=>
string(1) "0"
["term_taxonomy_id"]=>
string(3) "556"
["taxonomy"]=>
string(8) "post_tag"
["description"]=>
string(0) ""
["parent"]=>
string(1) "0"
["count"]=>
string(1) "1"
["object_id"]=>
string(4) "1931"
}
}
// GRAB THE ARRAY OF OBJECTS
$my_arr = get_the_tags($postid);
// PROCESS INTO AN ARRAY OF SORTABLE LINKS
$my_new = array();
foreach ($my_arr as $my_obj)
{
$my_term = (string)$my_obj->term_id;
$my_name = (string)$my_obj->name;
$my_slug = (string)$my_obj->slug;
$my_link
= '<h??? class="mytags">'
. '<a href="http://www.sure-start.com/tag/'
. $my_slug
. '/" rel="tag">'
. $my_name
. '</a></h1><br />'
;
$my_akey = 'X' . str_pad($my_term, 8, '0', STR_PAD_LEFT);
$my_new[$my_akey] = $my_link;
}
// SORT THE ARRAY BY KEY DESCENDING
krsort($my_new);
// SLICE OFF THE <h1> AND <h2> ELEMENTS
$my_tags = NULL;
$my_tags .= str_replace('???', '1', array_shift($my_new)) . PHP_EOL;
$my_tags .= str_replace('???', '2', array_shift($my_new)) . PHP_EOL;
$my_tags .= str_replace('???', '2', array_shift($my_new)) . PHP_EOL;
// ROUND UP THE REST OF THE <h3> ELEMENTS
foreach ($my_new as $my_link)
{
$my_tags .= str_replace('???', '3', $my_link) . PHP_EOL;
}
// GRAB THE ARRAY OF OBJECTS
$my_arr = get_the_tags($postid);
// PROCESS INTO AN ARRAY OF SORTABLE LINKS
$my_new = array();
foreach ($my_arr as $my_obj)
{
$my_term = (string)$my_obj->term_id;
$my_name = (string)$my_obj->name;
$my_slug = (string)$my_obj->slug;
$my_link
= '<h??? class="mytags">'
. '<a href="http://www.sure-start.com/tag/'
. $my_slug
. '/" rel="tag">'
. $my_name
. '</a></h???><br />'
;
$my_akey = 'X' . str_pad($my_term, 8, '0', STR_PAD_LEFT);
$my_new[$my_akey] = $my_link;
}
// SORT THE ARRAY BY KEY DESCENDING
krsort($my_new);
// SLICE OFF THE <h1> AND <h2> ELEMENTS
$my_tags = NULL;
$my_tags .= str_replace('???', '1', array_shift($my_new)) . PHP_EOL;
$my_tags .= str_replace('???', '2', array_shift($my_new)) . PHP_EOL;
$my_tags .= str_replace('???', '2', array_shift($my_new)) . PHP_EOL;
// ROUND UP THE REST OF THE <h3> ELEMENTS
foreach ($my_new as $my_link)
{
$my_tags .= str_replace('???', '3', $my_link) . PHP_EOL;
}
// DISPLAY THE TAGS
echo $my_tags;
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
I've written some code to do this (years ago) that was driven off the most popular search terms. We kept a data base table with popular search terms. By adding the letter 'S' to the end of the term (essentially making all of them plurals) and storing the metaphone() string as the search key, we had pretty good consolidation of results. So we got "bulletin" and "bulletins" matched up. We kept a count of popular terms and a DATETIME so that we could age the popularity. Christmas will be coming soon, and Easter will arrive in the spring. The aging let us keep the most popular terms current. It was fun to write and see it in action, but in the end, we dropped the cloud from the site in favor of a more prosaic "popular search" list.
It was not a WP feature, but I can tell you the central parts - we kept the count so we could choose the popularity and use that to determine which words got the H1, H2, etc. And we used a random order for our selection. A few lines of PHP and some CSS rounded it out into a nice little sidebar box. Wish I still had the code around, but maybe the narrative is enough to stimulate your thinking.
Hopefully some of these search results will be useful...
http://lmgtfy.com?q=Wordpress+tag+cloud
Best regards, ~Ray