GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   wordpress tip: spice up your tag cloud (https://gfy.com/showthread.php?t=933942)

fris 10-18-2009 10:57 AM

wordpress tip: spice up your tag cloud
 
This will take your tag cloud and use random colors, instead of 1 color which is the default output.

add this to your themes functions.php file

Code:

function colorcloud($text) {
    $text = preg_replace_callback('|<a (.+?)>|i', 'colorcallback', $text);
    return $text;
}

function colorcallback($matches) {
    $text = $matches[1];
    $color = dechex(rand(0,16777215));
    $pattern = '/style=(\'|\")(.*)(\'|\")/i';
    $text = preg_replace($pattern, "style=\"color:#{$color};$2;\"", $text);
    return "<a $text>";
}

add_filter('wp_tag_cloud', 'colorcloud', 1);

and in your sidebar place the wp_tag_cloud() function.

Code:

<?php wp_tag_cloud('smallest=8&largest=24&number=50'); ?>

kmanrox 10-18-2009 10:59 AM

good stuff fris.. i thought u were going to recommend the cumulus plugin lol

Jdoughs 10-18-2009 12:37 PM

Quote:

Originally Posted by kmanrox (Post 16440893)
good stuff fris.. i thought u were going to recommend the cumulus plugin lol

Just a note about that cumulus plugin, if you use it, make sure to noindex the directory with all the flash clips, I had a site I used it on a couple months ago and it indexed and cached all the flash files from that pluging (about 200 extra junk pages or files listed in the engine)

Elli 10-18-2009 01:32 PM

Here I thought tag clouds were outdated already... is it just me who finds them annoying?

Jdoughs 10-18-2009 01:34 PM

Quote:

Originally Posted by Elli (Post 16441167)
Here I thought tag clouds were outdated already... is it just me who finds them annoying?

The tag clouds are one of the most clicked areas on my traffic blogs. I guess it all depends on how effective they are done, and how they are utilized on page.

Elli 10-18-2009 02:25 PM

Quote:

Originally Posted by Jdoughs (Post 16441170)
The tag clouds are one of the most clicked areas on my traffic blogs. I guess it all depends on how effective they are done, and how they are utilized on page.

Woah, really? Hmm.. .maybe I'll have to give them another shot :)

VforVendetta 10-18-2009 03:38 PM

thanks!! Good tip!

Zyzz 10-18-2009 03:54 PM

Useful snippet adds a refreshing look to the sidebar!

$5 submissions 10-18-2009 03:58 PM

Quote:

Originally Posted by Elli (Post 16441167)
Here I thought tag clouds were outdated already... is it just me who finds them annoying?

Judging from my own sites, tag clouds get clicked a lot. Easy to scan. Scan and click.:thumbsup

TeenSluts 10-18-2009 05:26 PM

thank you

closer 10-18-2009 05:28 PM

Great Tip fris


All times are GMT -7. The time now is 02:36 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc