<?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>Cozmoslabs &#187; category</title>
	<atom:link href="http://www.cozmoslabs.com/tag/category/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cozmoslabs.com</link>
	<description>Web design and development experiment.</description>
	<lastBuildDate>Fri, 03 Feb 2012 16:05:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Replacing the Thematic Menu with a DropDown List of Categories</title>
		<link>http://www.cozmoslabs.com/202-replacing-the-thematic-menu-with-a-dropdown-list-of-categories/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=replacing-the-thematic-menu-with-a-dropdown-list-of-categories</link>
		<comments>http://www.cozmoslabs.com/202-replacing-the-thematic-menu-with-a-dropdown-list-of-categories/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 03:27:54 +0000</pubDate>
		<dc:creator>Cristian</dc:creator>
				<category><![CDATA[Recomended Reading]]></category>
		<category><![CDATA[Theme Design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[menu dropdown]]></category>
		<category><![CDATA[Thematic]]></category>

		<guid isPermaLink="false">http://www.cozmoslabs.com/?p=202</guid>
		<description><![CDATA[There comes a time when you might want to use the Thematic Theme for other things then just a blog, like a magazine or a portal and it might be best suited to have the categories of your blog on top instead of your static pages. After all, you&#8217;ll probably have two static pages (about [...]
Related posts:<ol>
<li><a href='http://www.cozmoslabs.com/358-add-a-search-box-to-the-thematic-menu/' rel='bookmark' title='Add a search box to the thematic menu'>Add a search box to the thematic menu</a></li>
<li><a href='http://www.cozmoslabs.com/300-quickly-add-a-category-dropdown-to-thematic-09/' rel='bookmark' title='Quickly add a Category DropDown to Thematic 0.9'>Quickly add a Category DropDown to Thematic 0.9</a></li>
<li><a href='http://www.cozmoslabs.com/284-thematic-drop-down-menu/' rel='bookmark' title='Drop Down Menu for Thematic'>Drop Down Menu for Thematic</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="postimage"><img src="http://www.cozmoslabs.com/wp-content/uploads/2008/12/catdrop.jpg" alt="Thematic Menu DropDown" title="Thematic Menu DropDown" width="300" height="200" class="alignnone size-full wp-image-208" /></div>
<p>There comes a time when you might want to use the <a href="http://themeshaper.com/thematic-for-wordpress/">Thematic Theme</a> for other things then just a blog, like a magazine or a portal and it might be best suited to have the categories of your blog on top instead of your static pages. After all, you&#8217;ll probably have two static pages (about and contact) and several categories and subcategories.</p>
<p>I&#8217;ve seen this request twice in the <a href="http://themeshaper.com/forums/">forums</a> over at ThemeShaper and I&#8217;ll now try and answer it. </p>
<p><strong>I&#8217;ve created a the <em>CatDrop Child Theme</em> that dose just that: transforms Thematic&#8217;s menu into a magazine style category based one!</strong></p>
<div id="preview_download"><a href="http://www.cozmoslabs.com/projects/wp/?theme=catdrop" target="_blank"><img src="http://www.cozmoslabs.com/wp-content/uploads/2008/12/preview.gif" border="0" alt="preview child theme" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="downloadlink dlimg" href="http://www.cozmoslabs.com/wp-content/plugins/download-monitor/download.php?id=2" title="Version 0.1 downloaded 1977 times" ><img src="http://www.cozmoslabs.com/wp-content/uploads/2010/11/download.jpg" alt="Download Category DropDown for thematic Version 0.1" /></a></div>
<p><span id="more-202"></span></p>
<div id="showcase_blogs" style="background:#caf8b2;">
In order to install it you have to download the <a href="http://themeshaper.com/thematic-for-wordpress/" onclick="javascript:pageTracker._trackPageview ('/outbound/themeshaper.com');">Thematic Theme</a> (from which this child theme inherits all of the functionality), upload both themes (CatDrop and Thematic) to your server in the themes folder AND THEN ACTIVATE the CatDrop theme.
</div>
<p>Assuming you&#8217;ve already downloaded the latest version of<a href="http://wordpress.org/extend/themes/thematic">Thematic</a> (at the time of the writing it was version 0.7) and uploaded it inside your <em>wp-content/themes</em> directory, we can start the tutorial.</p>
<p>We won&#8217;t modify Thematic directly, instead we&#8217;ll create a <a href="http://www.cozmoslabs.com/2008/09/07/use-wordpress-as-a-cms-with-thematic-part1/">Child theme</a> and add this functionality to it. To do just that create a directory named <em>catdrop</em> inside your themes folder and two files: <em>functions.php</em> and <em>style.css</em>.</p>
<p>We&#8217;ll start by telling WordPress that our theme is a ChildTheme of thematic add this code into <em>style.css</em>.</p>

<div class="wp_codebox"><table><tr id="p2023"><td class="code" id="p202code3"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
Theme Name: CatDrop
Theme URI: http://cozmoslabs.com/
Description: Built on Thematic Theme&lt;/a&gt;
Author: Cristi Antohe
Author URI: http://cozmoslabs.com/
Template: thematic
Version: 0.1
.
This work, like WordPress, is released under GNU General Public License, version 2 (GPL).
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
.
*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Reset browser defaults */</span>
<span style="color: #a1a100;">@import url('../thematic/library/styles/reset.css');</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Apply basic typography styles */</span>
<span style="color: #a1a100;">@import url('../thematic/library/styles/typography.css');</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Apply a basic layout */</span>
<span style="color: #a1a100;">@import url('../thematic/library/layouts/2c-r-fixed.css');</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Apply basic image styles */</span>
<span style="color: #a1a100;">@import url('../thematic/library/styles/images.css');</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Apply default theme styles and colors */</span>
<span style="color: #a1a100;">@import url('../thematic/library/styles/default.css');</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Prepare theme for plugins */</span>
<span style="color: #a1a100;">@import url('../thematic/library/styles/plugins.css');</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/************************************************ Style for drop-down menu */</span>
<span style="color: #cc00cc;">#header</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">99</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE7 z-index bug */</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#access</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">static</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">37px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu</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;">static</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;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0pt</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0pt</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0pt</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0pt</span><span style="color: #00AA00;">;</span>
	overflow-x<span style="color: #00AA00;">:</span> <span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span>
	overflow-y<span style="color: #00AA00;">:</span> <span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu</span> ul<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</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: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu</span> ul li ul<span style="color: #00AA00;">&#123;</span>
&nbsp;
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu</span> li<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu</span> li a<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</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: #933;">0px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">11em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#6DA5D6</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#menu</span> li li li 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;">#B5D1EA</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#main</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>I&#8217;ve added some stilling to the <em>#access</em> and <em>#menu</em> divs or the theme would look odd.</p>
<p>Next we need to create our <em>functions.php</em> file. Add the following code to it:</p>

<div class="wp_codebox"><table><tr id="p2024"><td class="code" id="p202code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/* Create unordered lists with our categories */</span>
<span style="color: #000000; font-weight: bold;">function</span> categ_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;menu&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sf-menu&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_option('home'); ?&gt;/&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;on&quot;</span><span style="color: #339933;">&gt;</span>Home<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
 	<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'orderby=name&amp;amp;amp;exlude=181&amp;amp;amp;title_li='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 	<span style="color: #000088;">$this_category</span> <span style="color: #339933;">=</span> get_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>get_category_children<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;&quot;</span><span style="color: #339933;">;</span>
			wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'orderby=id&amp;amp;amp;show_count=0&amp;amp;amp;title_li=&amp;amp;amp;use_desc_for_title=1&amp;amp;amp;child_of='</span><span style="color: #339933;">.</span><span style="color: #000088;">$this_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
 	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">/* Add the needed style and javascript for the dropdown */</span>
<span style="color: #000000; font-weight: bold;">function</span> add_to_head<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>	
<span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_stylesheet_directory_uri(); ?&gt;/superfish/superfish.css&quot;</span> media<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;screen&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_stylesheet_directory_uri(); ?&gt;/superfish/hoverIntent.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_stylesheet_directory_uri(); ?&gt;/superfish/superfish.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #666666; font-style: italic;">// initialise plugins</span>
	jQuery<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		jQuery<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ul.sf-menu'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>superfish<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            delay<span style="color: #339933;">:</span>       <span style="color: #cc66cc;">300</span><span style="color: #339933;">,</span>                            <span style="color: #666666; font-style: italic;">// one second delay on mouseout </span>
            speed<span style="color: #339933;">:</span>       <span style="color: #0000ff;">'fast'</span><span style="color: #339933;">,</span>                         <span style="color: #666666; font-style: italic;">// faster animation speed </span>
            autoArrows<span style="color: #339933;">:</span>  <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>                          <span style="color: #666666; font-style: italic;">// disable generation of arrow mark-up </span>
            dropShadows<span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">true</span>                            <span style="color: #666666; font-style: italic;">// disable drop shadows </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: #000000; font-weight: bold;">&lt;/script&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_to_head'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_page_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'categ_menu'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The <em>categ_menu</em> function is the one that generates the list of categories and the <em>add_to_head</em> one is adding the needed css and javascript files to out Child Theme.(you can get the files from the Child theme download). This could be easily modified to support drop-down pages for the menu but that one some other time!</p>
<p><strong>And this is the way you make Thematic similar to a magazine style WordPress theme!</strong></p>
<p>Related posts:<ol>
<li><a href='http://www.cozmoslabs.com/358-add-a-search-box-to-the-thematic-menu/' rel='bookmark' title='Add a search box to the thematic menu'>Add a search box to the thematic menu</a></li>
<li><a href='http://www.cozmoslabs.com/300-quickly-add-a-category-dropdown-to-thematic-09/' rel='bookmark' title='Quickly add a Category DropDown to Thematic 0.9'>Quickly add a Category DropDown to Thematic 0.9</a></li>
<li><a href='http://www.cozmoslabs.com/284-thematic-drop-down-menu/' rel='bookmark' title='Drop Down Menu for Thematic'>Drop Down Menu for Thematic</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.cozmoslabs.com/202-replacing-the-thematic-menu-with-a-dropdown-list-of-categories/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>

