Embed Tag Cloud (In Other Than Sidebar)
I try to embed WordPress tag cloud to the header part of the theme. Tag print is called from wp_tag_cloud('smallest=8&largest=16')
. One example would be by inserting that function in this part of header.php
of the corresponding theme:
1 2 3 4 5 6 7 8 9 10 | <div class="header"> <?php if (is_home()) : ?> <h1><?php bloginfo('name'); ?> <span><?php bloginfo('description'); ?></span></h1> <?php wp_tag_cloud('smallest=8&largest=16'); ?> <?php else : ?> <h1><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a> <span><?php bloginfo('description'); ?></span></h1> <?php endif; ?> </div> |
Another embedding option is to use the famous wp-cumulus
plugin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | <?php //wp_tag_cloud('smallest=8&largest=16'); ob_start(); wp_tag_cloud('smallest=8&largest=16'); $tagcloud = urlencode( str_replace( " ", " ", ob_get_clean() ) ); //echo $tagcloud; //echo "'.urlencode('<tags>') . $tagcloud . urlencode('</tags>').'"; /*$options = get_option('wpcumulus_options');*/ $movie = plugins_url('wp-cumulus/tagcloud.swf'); $path = plugins_url('wp-cumulus/'); $options['width']='550'; $options['height']='200'; $options['bgcolor'] = '333333'; $options['tcolor'] = '000000'; $options['tcolor2'] = '000000'; $options['hicolor'] = 'ffffff'; $options['speed'] = '100'; $options['distr'] = 'true'; $options['mode'] = 'tags'; $options['args'] = ''; $options['compmode'] = 'true'; $options['showwptags'] = 'true'; $options['trans'] = 'true'; $soname .= rand(0,9999999); $movie .= '?r=' . rand(0,9999999); $divname .= rand(0,9999999); // write flash tag if( $options['compmode']!='true' ){ $flashtag = '<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->'; $flashtag .= '<script type="text/javascript" src="'.$path.'swfobject.js"></script>'; $flashtag .= '<div id="'.$divname.'">'; if( $options['showwptags'] == 'true' ){ $flashtag .= '<p>'; } else { $flashtag .= '<p style="display:none;">'; }; // alternate content if( $options['mode'] != "cats" ){ $flashtag .= urldecode($tagcloud); } if( $options['mode'] != "tags" ){ $flashtag .= urldecode($cats); } $flashtag .= '</p><p>WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better.</p></div>'; $flashtag .= '<script type="text/javascript">'; $flashtag .= 'var '.$soname.' = new SWFObject("'.$movie.'", "tagcloudflash", "'.$options['width'].'", "'.$options['height'].'", "6", "#'.$options['bgcolor'].'");'; if( $options['trans'] == 'true' ){ $flashtag .= $soname.'.addParam("wmode", "transparent");'; } $flashtag .= $soname.'.addParam("allowScriptAccess", "always");'; $flashtag .= $soname.'.addVariable("tcolor", "0x'.$options['tcolor'].'");'; $flashtag .= $soname.'.addVariable("tcolor2", "0x' . ($options['tcolor2'] == "" ? $options['tcolor'] : $options['tcolor2']) . '");'; $flashtag .= $soname.'.addVariable("hicolor", "0x' . ($options['hicolor'] == "" ? $options['tcolor'] : $options['hicolor']) . '");'; $flashtag .= $soname.'.addVariable("tspeed", "'.$options['speed'].'");'; $flashtag .= $soname.'.addVariable("distr", "'.$options['distr'].'");'; $flashtag .= $soname.'.addVariable("mode", "'.$options['mode'].'");'; // put tags in flashvar if( $options['mode'] != "cats" ){ $flashtag .= $soname.'.addVariable("tagcloud", "'.urlencode('<tags>') . $tagcloud . urlencode('</tags>').'");'; } // put categories in flashvar if( $options['mode'] != "tags" ){ $flashtag .= $soname.'.addVariable("categories", "' . $cats . '");'; } $flashtag .= $soname.'.write("'.$divname.'");'; $flashtag .= '</script>'; } else { $flashtag = '<object type="application/x-shockwave-flash" data="'.$movie.'" width="'.$options['width'].'" height="'.$options['height'].'">'; $flashtag .= '<param name="movie" value="'.$movie.'" />'; $flashtag .= '<param name="bgcolor" value="#'.$options['bgcolor'].'" />'; $flashtag .= '<param name="AllowScriptAccess" value="always" />'; if( $options['trans'] == 'true' ){ $flashtag .= '<param name="wmode" value="transparent" />'; } $flashtag .= '<param name="flashvars" value="'; $flashtag .= 'tcolor=0x'.$options['tcolor']; $flashtag .= '&tcolor2=0x'.$options['tcolor2']; $flashtag .= '&hicolor=0x'.$options['hicolor']; $flashtag .= '&tspeed='.$options['speed']; $flashtag .= '&distr='.$options['distr']; $flashtag .= '&mode='.$options['mode']; // put tags in flashvar if( $options['mode'] != "cats" ){ $flashtag .= '&tagcloud='.urlencode('<tags>') . $tagcloud . urlencode('</tags>'); } // put categories in flashvar if( $options['mode'] != "tags" ){ $flashtag .= '&categories=' . $cats; } $flashtag .= '" />'; // alternate content if( $options['mode'] != "cats" ){ $flashtag .= '<p>'.urldecode($tagcloud).'</p>'; } if( $options['mode'] != "tags" ){ $flashtag .= '<p>'.urldecode($cats).'</p>'; } $flashtag .= '<p>WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better.</p>'; $flashtag .= '</object>'; } print $flashtag; ?> |
About
+Arif Kusbandono
Recently
Et Cetera
© logIt. Powered by WordPress using the DePo Skinny Tweaked Theme.