wordpress tip: spice up your tag cloud

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fris
    I have to go potty
    • Aug 2002
    • 55854

    #1

    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'); ?>
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


    My Newest Theme
  • kmanrox
    aka K-Man
    • Oct 2001
    • 29295

    #2
    good stuff fris.. i thought u were going to recommend the cumulus plugin lol
    Crypto HODLr
    Crypto mining
    Angel investor

    Comment

    • Jdoughs
      Confirmed User
      • Mar 2004
      • 5794

      #3
      Originally posted by kmanrox
      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)
      LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
      Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
      AmeriNOC - Proudly hosted @ AmeriNOC!

      Comment

      • Elli
        Reach for those stars!
        • Apr 2003
        • 17991

        #4
        Here I thought tag clouds were outdated already... is it just me who finds them annoying?
        email: [email protected]

        Comment

        • Jdoughs
          Confirmed User
          • Mar 2004
          • 5794

          #5
          Originally posted by Elli
          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.
          LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
          Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
          AmeriNOC - Proudly hosted @ AmeriNOC!

          Comment

          • Elli
            Reach for those stars!
            • Apr 2003
            • 17991

            #6
            Originally posted by Jdoughs
            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
            email: [email protected]

            Comment

            • VforVendetta
              Confirmed User
              • Mar 2006
              • 2525

              #7
              thanks!! Good tip!
              Free the world

              Comment

              • Zyzz
                So Fucking Banned!
                • Jul 2006
                • 5223

                #8
                Useful snippet adds a refreshing look to the sidebar!

                Comment

                • $5 submissions
                  I help you SUCCEED
                  • Nov 2003
                  • 32189

                  #9
                  Originally posted by Elli
                  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.

                  Comment

                  • TeenSluts
                    Confirmed User
                    • Mar 2006
                    • 1966

                    #10
                    thank you

                    Comment

                    • closer
                      Confirmed User
                      • Sep 2005
                      • 1707

                      #11
                      Great Tip fris

                      Comment

                      Working...