<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>U-notez &#187; User interfaces</title>
	<atom:link href="http://www.unitz.com/u-notez/category/user-interfaces/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unitz.com/u-notez</link>
	<description>Web development tips, ideas and discoveries from Unitz LLC</description>
	<lastBuildDate>Mon, 16 Aug 2010 18:41:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Cufón Small Caps Hack</title>
		<link>http://www.unitz.com/u-notez/2010/06/a-cufon-small-caps-hack/</link>
		<comments>http://www.unitz.com/u-notez/2010/06/a-cufon-small-caps-hack/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 04:13:37 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[cufón small-caps]]></category>
		<category><![CDATA[font replacement]]></category>
		<category><![CDATA[small caps]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=252</guid>
		<description><![CDATA[I love the cufón font replacement technique. It allows developers to use custom fonts dynamically in their websites.  It&#8217;s incredibly easy to use compared to earlier options like siFR.  The@font-face CSS3 property (and Google Font Directory!) are  of course an even better solution, but the limited browser support means  we&#8217;ll have to wait [...]]]></description>
			<content:encoded><![CDATA[<p>I love the <a href="http://cufon.shoqolate.com/generate/" target="_blank">cufón </a>font replacement technique. It allows developers to use custom fonts dynamically in their websites.  It&#8217;s incredibly easy to use compared to earlier options like siFR.  The@font-face CSS3 property (and <a href="http://code.google.com/webfonts" target="_blank">Google Font Directory</a>!) are  of course an even better solution, but the limited browser support means  we&#8217;ll have to wait awhile before this approach has dominance. For now, Cufón is easy enough and works in just about <a href="http://wiki.github.com/sorccu/cufon/" target="_blank">every browser</a> &#8211; even IE6!</p>
<p><span id="more-252"></span></p>
<p>I&#8217;ve used this approach recently for several sites with dynamic page titles with great success.  That doesn&#8217;t mean it still has some <a href="http://wiki.github.com/sorccu/cufon/known-bugs-and-issues" target="_blank">limitations</a>. The two biggest in my opinion are the inability to select the replaced text, and the lack of a reliable hover option (so you can change the replaced font color on mouse-over). Another issue that has affected me is the lack of small-caps support. Although it&#8217;s slated to be included in a future Cufon version, I hacked together an approach that works now using jQuery and JavaScript regular expressions.</p>
<p>The process is fairly simple &#8211; first replace your text with Cufón, then run a regular expression that inserts SPAN tags around the first letter of each word, and then use jQuery to increase the font size of these span&#8217;s classes. Simply setting the classes font-size larger in CSS before hand does not work.</p>
<p>Below you can see the three stages of the process that I went through &#8211; first I loaded up a headline that uses the CSS small caps attribute &#8211; it works but it&#8217;s not the font I want. The next headline is Cufon replaced &#8211; it looks much better, but I&#8217;ve lost the small caps effect. Finally using the hack, I&#8217;ve achieved the custom font with small caps.</p>
<p><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/06/cufon-yui.js"></script><script type="text/javascript" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/06/agp_400.font_.js"></script></p>
<style type="text/css">h1.post {
font-family:times,times new roman, serif;
font-size:20px;
font-variant:small-caps;
color:#900;
}h1#test3 {
text-transform:uppercase;
}h1 span.caps {
	position:relative;
	top:2px;	
}</style>
<p><script type="text/javascript">jQuery(document).ready(function($) {
	Cufon.replace('h1#test2', { fontFamily: 'agp' });
	var text = $('h1#test2').html();
	$('h1#post2').html(text.replace(/\b([A-Za-z0-9])/g,'<span class="caps">$1</span>'));
	Cufon.replace('h1#test3', { fontFamily: 'agp' });
	var text = $('h1#test3').html();
	$('h1#test3').html(text.replace(/\b([A-Za-z0-9])/g,'<span class="caps">$1</span>'));
	$('.caps').css('font-size',30);});</script></p>
<h1 class="post" id="test1">Un-replaced Text with Small Caps</h1>
<h1 class="post" id="test2">Replaced Text before Small Caps Hack</h1>
<h1 class="post" id="test3">Replaced Text with Small Caps</h1>
<p>The first step is to load in your various javascript files. You can download cufon and create your own font javascript files at <a href="http://cufon.shoqolate.com" target="_blank">cufon.shoqolate.com</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;PATHTO/cufon-yui.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;PATHTO/font-file-you-create.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Then you can set up the styles you want your headlines to have:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #3333ff;">:times</span><span style="color: #00AA00;">,</span>times new roman<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span><span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#900</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>The next step is to create your headline:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>This is the headline I'm font-replacing<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span></pre></div></div>

<p>Finally, use the follow JavaScript to create the effect:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	Cufon.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> text <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>text.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\b([A-Za-z0-9])/g</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'&lt;span class=&quot;caps&quot;&gt;$1&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.caps'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'font-size'</span><span style="color: #339933;">,</span><span style="color: #CC0000;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This script, which loads when the DOM is ready, first replaces the font, then inserts &lt;span class=&#8221;caps&#8221;&gt; around the first letter of each word, and finally increases the font size on these first letters from 20px to 30px. You can of course change these font sizes to meet your needs. The particular font I used here, Adobe Garamond Pro, had a slight line-height offset after this JavaScript was run &#8211; I fixed this with a style for the &#8216;caps&#8217; CSS class &#8211; you may need something similar for the font you choose</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 span<span style="color: #6666ff;">.caps</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I hope someone finds this useful.</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F06%2Fa-cufon-small-caps-hack%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/06/a-cufon-small-caps-hack/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using the WordPress 3.0 Menus Feature Part 2 &#8211; Styling and Animating</title>
		<link>http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/</link>
		<comments>http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/#comments</comments>
		<pubDate>Mon, 31 May 2010 12:45:51 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=216</guid>
		<description><![CDATA[Welcome back! Since my first post, where I demonstrated the simple yet powerful WordPress 3.0 Menu Management functionality, WordPress 3.0 RC1 has been released! With this great new tool, WordPress has become an even more robust option for content management. Now non-technical users can easily manage the navigation (including drop-down menus) of their site through [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/images.jpg" alt="" title="images" width="118" height="118" class="alignright size-full wp-image-194" />Welcome back! Since my <a href="http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/" target="_blank">first post</a>, where I demonstrated the simple yet powerful <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank">WordPress 3.0 Menu Management</a> functionality, <a href="http://wordpress.org/development/2010/05/wordpress-3-0-release-candidate/" target="_blank">WordPress 3.0 RC1</a> has been released! With this great new tool, WordPress has become an even more robust option for content management. Now non-technical users can easily manage the navigation (including drop-down menus) of their site through a WYSIWYG environment.</p>
<p>In this second post, I&#8217;m going to explore the code generated by this functionality, and give a simple demonstration of how to style and animate the generated menus using  CSS and <a href="http://www.jquery.com" target="_blank">jQuery</a>. You can then use these skills to develop your own WordPress 3.0 theme and its menus.</p>
<p><span id="more-216"></span></p>
<p>Here&#8217;s a demonstration video of the end result. The menus were created using the WordPress Menu Management functionality and are set to animate down and fade in on mouseover, and utilize CSS3 gradients and rounded corners. Refer back to <a href="http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/" target="_blank">part I</a> to see how the menus were created initially.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="675" height="481" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="675" height="481" src="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Our first step will be to add styling to the menus. As with the previous post, I am basing these instructions on the default WordPress 3.0 Theme &#8220;Twenty Ten.&#8221; It&#8217;s important to understand all of the pieces of code that come together to draw the menus. For this example, 3 files will come into play.</p>
<p>The first is header.php in the theme&#8217;s root directly. This is the file that draws the header part of your pages. In the Twenty Ten theme, it includes a call to wp_nav_menu(). This is the function that queries WordPress for the menu in HTML. It takes several optional parameters, which I won&#8217;t get into here &#8211; they&#8217;re described at <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank">http://codex.wordpress.org/Function_Reference/wp_nav_menu</a> if you&#8217;d like to explore &#8211; they let you change CSS classes, wrapper &lt;DIV&gt;s, etc.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;access&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nav_menu<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'sort_column'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu_order'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'container_class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu-header'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'theme_location'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'primary'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></div></div>

<p>Sample output of this function is below. You&#8217;ll notice that WordPress draws the menu out using unordered lists. They nest secondary menus in additional &lt;ul&gt; tags. This is a very popular method to organize navigation and is highly customizable with CSS. If you&#8217;re unfamiliar with this approach, <a href="http://www.alistapart.com/articles/horizdropdowns/" target="_blank">A List Apart</a> has a very good explanation.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;access&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-header&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-wordpress-sandbox-menu&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-17&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Fruits<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sub-menu&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-19&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Oranges<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-20&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Apples<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-32&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Colors<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sub-menu&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-30&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Blue<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-31&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Red<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-33&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Links<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sub-menu&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-34&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Google<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item-35&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Yahoo!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Comparing this HTML output to the accompanying sample images and video, you&#8217;ll notice the drop-down portion of the navigation is in the nested &lt;UL&gt;s with a CSS class of &#8217;sub-menu&#8217;.  This is generated automatically by WordPress and this nesting structure is how you can add style and animation. Please note that for this demonstration, the HTML above has been simplified &#8211; my links are empty and I have also stripped out many additional class names that WordPress includes automatically for the UL&#8217;s and LI&#8217;s to make the HTML simpler to read. These classes can be very useful for detailed styling though, so consider reviewing your generated code when you do your implementation.</p>
<p>Now that we know how the menus are drawn in HTML, we can start to style and animate them. As mentioned earlier, my examples work on top of the Twenty Ten default WordPress 3.0 Theme, so I will show code from this theme. This theme has a GNU General Public License so we&#8217;re free to modify it and use it near any way we&#8217;d like &#8211; consider copying it and working on the copied version for your experimentation. </p>
<p>The CSS styles for the Twenty Ten theme are in the file styles.css in the main theme directory. Starting around line 370 of this file (in the RC1 version of WordPress at least), you&#8217;ll see a section of the CSS commented &#8216;Menu&#8217; that starts defining the menu&#8217;s styles.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* =Menu
-------------------------------------------------------------- */</span>
<span style="color: #cc00cc;">#access</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">940px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Looking through this section of CSS, you&#8217;ll see the various styles that set the colors and fonts used in the menus. In my example, I changed the background colors for the nested sub-menu lists. I also added gradients to them (these gradients only work on CSS3 compatible browsers). Specifically I styled &#8220;#access ul ul a&#8221; like so (the background-image calls set the gradient):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul ul a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">1em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">160px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span> 90deg<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#474747</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#939393</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span><span style="color: #00AA00;">,</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#939393</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#474747</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I also added rounded corners to the bottom of each sub-menu. Again this isn&#8217;t support on all browsers. To do this I modified &#8220;#access ul ul,&#8221; adding the following CSS. The extra bottom padding gives room for the rounded corners.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#474747</span><span style="color: #00AA00;">;</span>
	-moz-border-radius-bottomleft<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	-webkit-border-bottom-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	-moz-border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	-webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The key parts of the CSS that tell the menus to appear on mouseover are below:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	...
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&gt;</span> ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The first part tells the browser not to initially display the nested menus, but the second says do show them when the parent item is moused-over. To get our animation working, we&#8217;re going to comment out the &#8220;display:block&#8221; CSS &#8211; we&#8217;re going to instead control the display menu event with JavaScript.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&gt;</span> ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/*display:block;*/</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The simplest way to do this is with the help of a JavaScript library like <a href="http://www.jquery.com" target="_blank">jQuery</a>. WordPress already comes with jQuery so we need to load it in using the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank">wp_enqueue_script function</a>. The enqueue function is the safe way to add JavaScripts to WordPress to safeguard against various conflicts. We&#8217;re also going to load in a second JavaScript file we&#8217;re about to create called navigation.js.</p>
<p>Open up the header.php file and add</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'unitzNav'</span><span style="color: #339933;">,</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/navigation.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>to the HEAD section of the document. We&#8217;re now loading up the jQuery library automatically for use with every page. Now it&#8217;s time to create the navigation.js file we referenced earlier &#8211; create this file in the same directory as the rest of the theme files.</p>
<p>If you&#8217;re unfamiliar with the power of jQuery there are ample tutorials and discussions online. In a nutshell, jQuery makes once complicated JavaScript tasks very simple, that work in just about every browser.  We&#8217;re going to be using a simple effect for our menu animation but, many jQuery menu plugins and navigation techniques are available that you can use as well. <a href="http://designm.ag/tutorials/jquery-navigation/" target="_blank">Here</a> and <a href="http://www.1stwebdesigner.com/resources/38-jquery-and-css-drop-down-multi-level-menu-solutions/" target="_links">here</a> are resources to explore many such techniques.</p>
<p>Put the following in your navigation.js file:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//initial the menus</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.menu li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.sub-menu&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;show&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;show&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">800</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;swing&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.sub-menu&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;height&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;opacity&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Believe it or not, this short section of code is all it takes to get the drop down menu animation working across most browsers with jQuery. The outer wrapper is a jQuery function call that runs when the page is finished loading. It then tells the browser to animate open the instance of ul class=&#8221;sub-menu&#8221; whenever a parent list item is moused over.  Then, using the hover function, it tells the browser to animate closed this same menu when either the parent item or menu is moused out. </p>
<p>On the <a href="http://www.jquery.com" target="_blank">jQuery</a> website you can read more about this syntax and the available function parameters &#8211; many types of animations and effects can be used here.</p>
<p>This simple approach does have limitations &#8211; specifically, although the Twenty Ten theme and WordPress&#8217;s menu manager support more than two levels of navigation, this jQuery implementation does not and will break the lower menus. However, considering the relatively simple modifications, the effect is quite effective. </p>
<p>Thanks for taking the time to read these posts &#8211; I hope it gets you excited for the power of WordPress 3.0&#8217;s menu management and gets your thinking about ways to style and animate your own menus.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="675" height="481" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="675" height="481" src="http://vimeo.com/moogaloop.swf?clip_id=12117988&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F05%2Fhow-to-style-animate-wordpress-3-menus%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Using the WordPress 3.0 Menus Feature Part 1</title>
		<link>http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/</link>
		<comments>http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/#comments</comments>
		<pubDate>Thu, 20 May 2010 02:36:43 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Menus]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[WordPress 3.0]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=190</guid>
		<description><![CDATA[WordPress 3.0 adds a powerful new feature in Menus management. This post describes this feature and explains how to use it.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/images.jpg"><img class="alignright size-full wp-image-194" title="images" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/images.jpg" alt="" width="118" height="118" /></a>While WordPress 3.0 still hasn&#8217;t been officially released, the Beta releases have been available for testing for awhile now. A new feature that is getting a lot of <a href="http://net.tutsplus.com/tutorials/wordpress/10-features-to-look-forward-to-in-wordpress-3-0/" target="_blank">press</a> is the menus option. In this post, I&#8217;ll demonstrate how this new functionality works. I think you&#8217;ll agree that it has significant potential (see the video at the end of the post).  In my <a href="http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/">second post</a> in this series, I&#8217;ll delve into the code and show how to make modifications to the display of the menus, using CSS and <a href="http://www.jquery.com">jQuery</a>.</p>
<p>To follow along, you&#8217;ll need to download WordPress 3.o. You can visit the <a href="http://wordpress.org/development/" target="_blank">WordPress development blog </a>to find a link to the latest Beta, and soon version 3.0 will be released <a href="http://wordpress.org/download/" target="_blank">officially</a>. WordPress.org provides excellent installation <a href="http://codex.wordpress.org/Main_Page" target="_blank">documentation</a> if you need help installing.</p>
<p><span id="more-190"></span></p>
<h2>What is it?</h2>
<p>WordPress has come a long way since starting as purely a blogging platform. Thanks to its open framework, it has been modified through plug-ins to be a powerful content management system (CMS). Developers started using WordPress to drive entire sites full of content &#8211; not just blogs.  However, to do so required tricks and kludges to work properly. WordPress 3.0 makes the process much easier and truly makes WordPress a viable CMS platform.</p>
<div id="attachment_197" class="wp-caption alignleft" style="width: 385px"><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menus-sample.gif"><img class="size-full wp-image-197" title="menus-sample" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menus-sample.gif" alt="" width="375" height="230" /></a><p class="wp-caption-text">Simple Menus Controlled Through WordPress</p></div>
<p>WordPress has allowed users to create two different types of content &#8211; posts and pages. Posts are the blog posts themselves, generated over time. Pages, which are created through a similar interface, were meant to hold static content. All WordPress installations start with a single About Us &#8220;page&#8221; that the blogger can use to describe themselves. Developers have utilized these &#8220;pages&#8221; to create entire sites and used WordPress as a CMS so end users could edit content themselves. These developers used to have to manually create the navigation structure though, digging deep into the code, in order to create links to all of the pages they created. With WordPress 3.0, regular users can now not only create pages but also organize and arrange them into menus through the Menus sections&#8217; simple drag and drop interface.</p>
<h2>How do you use it?</h2>
<p>This post assumes that you&#8217;re using the default WordPress 3.0 Theme, called Twenty Ten, which has support for the menu manager built in. My  <a href="http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/">next post</a> in this series will explain how to modify the theme and change the display of the menu.</p>
<p>To explore the Menus feature,  start by creating a few sample pages in your fresh WordPress 3.0 installation. In my visual examples I have created a few pages named after fruits and colors. If you need help learning how to use the WordPress interface to create pages, WordPress.org has excellent <a href="http://codex.wordpress.org/Main_Page" target="_blank">documentation</a>.</p>
<div id="attachment_195" class="wp-caption alignright" style="width: 285px"><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin1.gif"><img class="size-full wp-image-195" title="menu-admin1" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin1.gif" alt="" width="275" height="418" /></a><p class="wp-caption-text">The Menus page in WordPress 3.0</p></div>
<p>Once your pages are created, click on the menus link in the left column of the administration area, under the &#8220;Appearance&#8221; heading. Please note that users need appropriate permissions to access this link. Two new columns of options appear to the right.</p>
<p>The left column allows you to choose the type of link you want to add to your menu. There are three types of menu items you can add:</p>
<ul>
<li><strong>Custom Links</strong> allow you to add menu items that link to external web pages. Enter the page&#8217;s address in the URL box and the name you want to use in the label box. In my visual examples I have used this section to add links to Google and Yahoo!</li>
<li><strong>Pages</strong> is where you add menu items that link to the WordPress pages you have created &#8211; in my examples the colors and fruits pages are available to me.</li>
<li><strong>Categories</strong> is the final option, and if you have created categories of blog posts, pages that list all posts in that category appear here.</li>
</ul>
<p>Select the check boxes next to the pages you want and click add to your menu. Add a few custom links if you&#8217;d like as well. These items will now all appear in the right column in a vertical list. The Twenty Ten theme draws the menus horizontally, so you need to visualize the appearance of the items left to right instead of top to bottom.</p>
<div id="attachment_196" class="wp-caption alignleft" style="width: 385px"><a href="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin2.gif"><img class="size-full wp-image-196" title="menu-admin2" src="http://www.unitz.com/u-notez/wp-content/uploads/2010/05/menu-admin2.gif" alt="" width="375" height="381" /></a><p class="wp-caption-text">Organizing Menu Items in WordPress 3.0</p></div>
<p>Now click and drag the items in the right column &#8211; you will notice that you can arrange them and adjust them left and right. The order you arrange them in is the order in which they appear. The adjustments you make left and right determine their hierarchy in the site. The leftmost items are your primary navigation. Items nested one notch to the right are the secondary navigation of their parent, and so on. In the Twenty Ten theme, the primary navigation items appear at all times at the top of the page, and when you mouse over them the secondary navigation menus appear. The third tier menus and so on appear to the right of their parent items when the parent is moused over.</p>
<p>WordPress generates standard XHTML <a href="http://www.alistapart.com/articles/taminglists/" target="_blank">lists for the menus</a>, which a WordPress template developer can then use to style your navigation menus any way you choose. Check back for part two of this series to see an example of how these menus can be modified visually.</p>
<h2>Who will use it?</h2>
<p>Although this functionality doesn&#8217;t seem particularly groundbreaking, it makes the process of adding pages and organizing content vastly simpler than before. Prior to WordPress 3.0 adding pages and updating navigation menus almost always required a phone call to the developer, which meant additional costs and lost turnaround time. Now website owners of nearly all technical skill levels can easily keep their sites updated and organized, without delay and without sacrificing the look and feel of the navigation.</p>
<p>View a demonstration of the functionality below &#8211; I first show the menu with 3 items &#8211; then I nest one menu under another through a simple drag and drop and reload the page to show the change.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="625" height="414" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=11886550&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="625" height="414" src="http://vimeo.com/moogaloop.swf?clip_id=11886550&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>In my  <a href="http://www.unitz.com/u-notez/2010/05/how-to-style-animate-wordpress-3-menus/">next post</a>, I will discuss the code that the Menus function generates, and show you how to add animation and style changes to it. Thanks for reading!</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F05%2Fhow-to-use-the-wordpress-3-menus-feature%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/05/how-to-use-the-wordpress-3-menus-feature/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>5 Reasons to Re-Evaluate your Web Vendors</title>
		<link>http://www.unitz.com/u-notez/2010/05/5-reasons-to-reevaluate-your-web-vendors/</link>
		<comments>http://www.unitz.com/u-notez/2010/05/5-reasons-to-reevaluate-your-web-vendors/#comments</comments>
		<pubDate>Mon, 03 May 2010 16:23:00 +0000</pubDate>
		<dc:creator>Paul Reilly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>
		<category><![CDATA[Vendors]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=164</guid>
		<description><![CDATA[&#8220;Wow how time flies! Remember way back in 2003, when the company decided we needed a fantastic website, with all of the latest bells and whistles? Well we did it, and it served us quite well at first. But it is showing its age now though, isn&#8217;t it? I guess it&#8217;s time to call the [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Wow how time flies! Remember way back in 2003, when the company decided we needed a fantastic website, with all of the latest bells and whistles? Well we did it, and it served us quite well at first. But it is showing its age now though, isn&#8217;t it? I guess it&#8217;s time to call the designers and developers and make some changes&#8230;.&#8221;</p>
<p>Does this scenario sound familiar? It&#8217;s sometimes hard to believe, but given the rapid speed of Internet growth, the cutting edge technology that companies worked so hard to implement just a few years ago is now outdated and insufficient.  I&#8217;ve been working with many companies that are coming to this realization, and an unfortunate trend has appeared. These companies, sadly are completely determined to keep using their 3rd party vendors and service providers.</p>
<p><span id="more-164"></span>Services and vendor offerings I am referring to include web hosting,  email, e-commerce and payment systems, surveys, content management  systems and video and photo services.  Reasons that companies don&#8217;t want to change vendors vary &#8211; they don&#8217;t want to make the effort required to change, they feel entrenched, they&#8217;re nervous of possible ramifications, etc.  Although these can sometimes be valid reasons, more often than not this short-sightedness ends up being more expensive, provides customers a sub-par user experience and limits the company in serveral other ways. Read on to learn why.</p>
<ol>
<li><strong>Cost</strong><br />
Cost is the most straightforward reason to consider a vendor switch. In the last five years, the number of internet service vendors has exploded &#8211; which has driven down overall costs. More products are based on open standards and existing frameworks and more are sold as a service and hosted in the cloud. Contrast this to what it took to install something like a shopping cart several years ago &#8211; then it was proprietary and customized &#8211; at a high cost. Often clients are still paying monthly fees for these outdated services &#8211; and drastically overpaying at that. Now they can consider new options and opportunities that improve what they offer their customers, at a much lower cost over the life of the website.</li>
<li><strong>Ease of Implementation<br />
</strong>Companies remember the hassles and time required to add that shopping cart or add that video to their site years ago and are hesitant to go through the same ordeal again. The small vendors they selected from limited options years ago took forever to respond and had poor documentation.  However, much has changed &#8211; many current providers are bigger with much larger customer bases. They&#8217;ve greatly improved the implementation process, with excellent documentation and sample code and robust APIs that give more flexibility for implementations. There are many customers that share sample code and have documented their implementations. Forums and responsive users abound to discuss and help in using the products. <em>Current vendors offer more services that are easier to add and maintain than before, at a reasonable cost</em>.</li>
<li><strong>More Available Options<br />
</strong>Today&#8217;s established vendors have a more dedicated focus and larger teams working to support their products. They are working to make their products as useful as possible and offer many new features and options. These new features make your website more useful to your own customers.</li>
<li><strong>Better Customer Support<br />
</strong>Along with some of the reasons these products are easier to implement is the improved customer support &#8211; the vendors are larger or more specialized and have knowledgeable dedicated staff to help your company use their products. And through forums and development websites, more customers are active in the discussions as well &#8211; making it much easier to implement the products than in the past.<strong> </strong></li>
<li><strong>Growth Opportunities<br />
</strong>Finally, the way the product will grow and improve is important to consider. Many of the vendors that have been around for many years have all but given up on keeping their products current. Reasons vary &#8211; perhaps their customer base is small and the product isn&#8217;t worth upgrading. Perhaps the vendors don&#8217;t have the right staff to keep the product current. If your vendor&#8217;s offering is the same now as it was five years ago &#8211; chances are they aren&#8217;t looking for ways to improve their product and your business &#8211; switching to a dedicated vendor will better ensure that your website will grow with more and better functionality in the future.</li>
</ol>
<p>With these reasons in hand, consider your current vendors and if they&#8217;re really meeting your needs. If you&#8217;re not sure, start researching their competition. Check the services provided and pricing. You may be surprised at what&#8217;s possible out of the box now, and how reasonably it can be priced. Good resources, aside from just <a href="http://www.google.com" target="_blank">Googling, </a>include <a href="http://www.techcrunch.com" target="_blank">TechCrunch </a>and <a href="http://www.mashable.com" target="_blank">Mashable</a>.</p>
<p>Let me know your thoughts. Have you found a new vendor that drastically improved your website?</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2010%2F05%2F5-reasons-to-reevaluate-your-web-vendors%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2010/05/5-reasons-to-reevaluate-your-web-vendors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Easy Color Customization for Embedded Google Calendars</title>
		<link>http://www.unitz.com/u-notez/2009/04/color-customization-for-embedded-google-calendars/</link>
		<comments>http://www.unitz.com/u-notez/2009/04/color-customization-for-embedded-google-calendars/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 18:07:22 +0000</pubDate>
		<dc:creator>Chris Dornfeld</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[User interfaces]]></category>

		<guid isPermaLink="false">http://www.unitz.com/u-notez/?p=12</guid>
		<description><![CDATA[Clients often come to us for assistance integrating an events calendar into a web site, and we frequently recommend Google Calendar.  It has a flexible and user-friendly interface for both web site visitors and calendar managers.  What it doesn&#8217;t have, unfortunately, is a way to customize its color scheme.
I had the opportunity to tackle this [...]]]></description>
			<content:encoded><![CDATA[<p>Clients often come to us for assistance integrating an events calendar into a web site, and we frequently recommend <a href="http://calendar.google.com/" target="_blank">Google Calendar</a>.  It has a flexible and user-friendly interface for both web site visitors and calendar managers.  What it doesn&#8217;t have, unfortunately, is a way to customize its color scheme.</p>
<p>I had the opportunity to tackle this shortcoming for a recent project and you can find a copy of my script below, followed by an explanation of the approach I used.<span id="more-12"></span>  With this script, you&#8217;ll be able to set your own color scheme for an embedded Google Calendar.  To illustrate, here are some screenshots showing &#8220;before&#8221; (on the left) and &#8220;after&#8221; (on the right):</p>
<p><img class="alignnone size-full wp-image-24" title="gcalendar-wrapper screenshots" src="http://www.unitz.com/u-notez/wp-content/uploads/2009/04/gcalendar-wrapper-screenshots.gif" alt="gcalendar-wrapper screenshots" width="690" height="236" /></p>
<p>Of course, you can use this script to make your embedded calendar appear any color you like.</p>
<h3>Requirements</h3>
<ul>
<li>PHP 4.3.0 or later</li>
<li>Support for one of the following JSON libraries:
<ul>
<li><a href="http://pecl.php.net/package/json" target="_blank">PECL JSON extension</a> (built in to PHP 5.2.0 and higher) <em>or</em></li>
<li><a href="http://pear.php.net/package/Services_JSON" target="_blank">PEAR::Services_JSON</a> package</li>
</ul>
</li>
<li>Support for one of the following http methods:
<ul>
<li><a href="http://www.php.net/manual/en/curl.installation.php" target="_blank">cURL extension</a> <em>or</em></li>
<li><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen" target="_blank">allow_url_fopen</a> configuration option</li>
</ul>
</li>
</ul>
<p>Check your <a href="http://www.php.net/phpinfo#function.phpinfo.examples" target="_blank">phpinfo</a> screen to see if your server meets the requirements &mdash; or, if you&#8217;re feeling lucky, just cross your fingers and run the script.</p>
<h3>Installation and Usage</h3>
<p><strong>1.</strong> Create your Google Calendar and <a href="http://www.google.com/support/calendar/bin/answer.py?hl=en&amp;answer=41207" target="_blank">embed the calendar on your web site</a> using your preferred size and settings.  Make sure it appears correctly with the default Google Calendar &#8220;skin&#8221;.</p>
<p><strong>2.</strong> <strong><a href="/downloads/gcalendar-wrapper-20100516.zip" onclick="pageTracker._trackPageview('/downloads/gcalendar-wrapper.zip')">Download the wrapper script</a></strong> (version 2010-05-16) as a ZIP file</p>
<p><strong>3.</strong> Unzip the archive to extract the script itself, <strong>gcalendar-wrapper.php</strong></p>
<p><strong>4.</strong> Edit <strong>gcalendar-wrapper.php</strong> in a text editor, such as Notepad</p>
<p><strong>5.</strong> Customize the following lines at the top of the script according to your needs:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Set your color scheme below
 */</span>
<span style="color: #000088;">$calColorBgDark</span>      <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#c3d9ff'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// dark background color</span>
<span style="color: #000088;">$calColorTextOnDark</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#000000'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// text appearing on top of dark bg color</span>
<span style="color: #000088;">$calColorBgLight</span>     <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#e8eef7'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// light background color</span>
<span style="color: #000088;">$calColorTextOnLight</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#000000'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// text appearing on top of light bg color</span>
<span style="color: #000088;">$calColorBgToday</span>     <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#ffffcc'</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// background color for &quot;today&quot; box</span></pre></td></tr></table></div>

<p>You can use a tool like the one at <a href="http://html-color-codes.info/" target="_blank">html-color-codes.info</a> to pick your HTML color codes.</p>
<p><strong>6.</strong> Upload <strong>gcalendar-wrapper.php</strong> to your web server</p>
<p><strong>7.</strong> On the pages where you display an embedded Google Calendar, change the calendar embedding code to point to <strong>gcalendar-wrapper.php</strong> instead of <strong>http://www.google.com/calendar/embed</strong> (or the equivalent URL if you&#8217;re using Google Apps for Domains).  For example, if your embedding code currently looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">iframe</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.google.com/calendar/embed?src=usa__en%40holiday.calendar.google.com</span>
<span style="color: #009900;">&amp;amp;ctz=America%2FNew_York&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot; border-width:0 &quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">frameborder</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">scrolling</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;no&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">iframe</span>&gt;</span></pre></div></div>

<p>edit the HTML to look like this instead:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">iframe</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;gcalendar-wrapper.php?src=usa__en%40holiday.calendar.google.com</span>
<span style="color: #009900;">&amp;amp;ctz=America%2FNew_York&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot; border-width:0 &quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">frameborder</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">scrolling</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;no&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">iframe</span>&gt;</span></pre></div></div>

<p><strong>8.</strong> Browse to your page to test out your customized calendar!  If you still see the standard Google Calendar appearance, make sure to clear your browser&#8217;s cache and try again.</p>
<h3>Limitations</h3>
<p>To keep things simple, this script reduces the Google Calendar color scheme to just 5 different colors, even though Google&#8217;s original stylesheet uses more shades.  In addition, images within the interface (such as the month previous/next arrows and Print icon) can&#8217;t be customized and will still appear in their original color (blue).</p>
<p>After creating this solution, I came across a similar skinning effort called <del datetime="2010-05-17T02:43:55+00:00">MyGoogleCal4</del> <a href="http://www.restylegc.com/" target="_blank" rel="nofollow">RESTYLEgc</a> that allows more fine-grained control over the calendar appearance.  It takes more legwork to create your own theme, but anyone interested in replacing the calendar graphics or making advanced stylesheet changes should definitely give it a look.</p>
<h3>Technical Details</h3>
<p>The <strong>gcalendar-wrapper.php</strong> script works by downloading the embedded Google Calendar source code from Google&#8217;s server, modifying CSS styles and JavaScript on the fly, then outputting the customized calendar code to the user&#8217;s browser.  The Google Calendar embedding code contains a JSON-encoded data structure with information about the calendar events plus external links to a JavaScript library and CSS stylesheet located elsewhere on Google&#8217;s servers.  For simplicity, this script just inserts new CSS and JavaScript directly into the main embedding code to override the relevant parts of those external files.</p>
<p>To change the color scheme, I started by scraping the stock Google Calendar stylesheet and identifying the minimal set of styles needed to apply new colors.  New style rules are generated dynamically based on the color scheme settings to save the hassle of repeatedly copying and pasting color codes in several places.  These custom styles are then inserted at the end of the HEAD section of the embedding code with priority set to override the original styles.</p>
<p>Google Calendar&#8217;s code makes use of relative links and file references that get thrown off when routed through the wrapper script, so it&#8217;s also necessary to make a change to the base URL within the JSON data structure that holds calendar event data.  The JSON string first has to be spliced out using a regular expression and converted to a PHP data structure we can manipulate, then serialized back into a JSON string to replace the original data.</p>
<h3>Keep in Mind&#8230;</h3>
<p>The calendar customization script is closely tied to Google Calendar&#8217;s underlying stylesheets and JavaScript code.  When Google launches a new version of Google Calendar (as they&#8217;ve done in the past when launching new features) this script may need to be updated to reflect Google&#8217;s changes.  When that happens, your embedded calendars may revert to the standard Google Calendar appearance or may even show an error message.  Don&#8217;t forget to check up on your calendars periodically so you&#8217;ll know if Google has made any major changes.  I&#8217;ll make an effort to post an updated wrapper script whenever I see that Google has revised its code.</p>
<p>Feel free to respond in the comments below with questions or suggestions.  I hope you find the script useful!</p>
<iframe class="me-likey" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.unitz.com%2Fu-notez%2F2009%2F04%2Fcolor-customization-for-embedded-google-calendars%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;height=80&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:80px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.unitz.com/u-notez/2009/04/color-customization-for-embedded-google-calendars/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
	</channel>
</rss>
