The Zeitgeist - And How-To

calendar Posted on April 15, 2007   comments 3 Comments

I found a nifty new plugin today called WP-Zeitgeist. While the results aren't nearly as structured as Google's Zeitgeist, I think it's pretty cool.

Basically, this plugin gives a way to visualize the search phrases folks have used to end up here at the blog. The more often a search term or phrase has been used, the larger it'll be in the cloud.

See it in action at the Zeitgeist page.

Here's how I did it.

To start, I created a new Page template (read more about WordPress Pages). To do that, I copied my theme's existing page.php to zeit.php. Opened up Zeit and edited the comment at top to make it easier to spot when chosing a template:

PHP:
  1. <?php
  2. /*
  3. Template Name: Zeitgeist - 2 col
  4. */
  5. ?>

Next, I needed to add the "tag" that actually displays the zeitgeist. I glanced over the code in my page template and located the code for The Loop. I want to display the tags right below that. Thus "the loop" code displays the Page content, created via the WP page editor.

Using the Default theme's page.php as an example, the loop looks like this:

PHP:
  1. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  2. <div class="post" id="post-<?php the_ID(); ?>">
  3. <h2><?php the_title(); ?></h2>
  4.     <div class="entry">
  5.         <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
  6.  
  7.         <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
  8.  
  9.     </div>
  10. </div>
  11. <?php endwhile; endif; ?>

Right below that last line, I added:

PHP:
  1. <span class="clouds">
  2.     <?php zeitgeist_display(1, 100, '', ''); ?>
  3. </span>

the zeitgeist_display() function is where all the magic happens. I wanted to style the links a bit differently than my theme's default, so I wrapped the whole thing in a span to make it easy on myself.

The last step is adding some CSS to my theme's stylesheet. Here's what I currently have, although I may be tweaking the relative text sizes a bit over time:

CSS:
  1. /* WP-ZeitGeist plugin */
  2. .cloud_0 {font-size: 60%;}
  3. .cloud_1 {font-size: 65%;}
  4. .cloud_2 {font-size: 70%;}
  5. .cloud_3 {font-size: 75%;}
  6. .cloud_4 {font-size: 80%;}
  7. .cloud_5 {font-size: 85%;}
  8. .cloud_6 {font-size: 90%;}
  9. .cloud_7 {font-size: 95%;}
  10. .cloud_8 {font-size: 100%;}
  11. .cloud_9 {font-size: 105%;}
  12. .cloud_10 {font-size: 110%;}
  13.  
  14. .clouds a:hover {color: #FF9C00;}
  15. .clouds a {text-decoration:none;}

The bottom two lines are for that clouds class that the span tag is using. They just handle the links look. The cloud_x classes are used for the relative sizes in the zeitgeist cloud. I modified a bit from whoo's sample, just playing around with it a bit.

And there you have it.

tags Tags: , , , ,

Related Posts Possibly Related Posts

Comments

3 Responses to “The Zeitgeist - And How-To”

  1. » pingback » House-Keeping » Solo Technology on April 15th, 2007 1:18 pm

  2. AgentSully on April 17th, 2007 8:46 am

    This is cool too. I just subscribed to your feed. cool site.

  3. Chris on April 17th, 2007 2:42 pm

    Hey AgentSully, glad you found some stuff you liked. Welcome aboard!

Leave a Reply




Have you read the Comments section on the Disclaimer page?

About

Wandering the Internet, looking at all things bright and shiny. Playing with many, writing about some. More …

Recent Posts

Recent Comments: