<?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>The Webmaster's Blog &#187; menu</title>
	<atom:link href="http://webmasters-blog.com/tag/menu/feed" rel="self" type="application/rss+xml" />
	<link>http://webmasters-blog.com</link>
	<description>A complete guide for making more money online through your sites.</description>
	<lastBuildDate>Mon, 05 Mar 2012 15:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Create horizontal drop-down menu for WordPress Categories/Pages</title>
		<link>http://webmasters-blog.com/howto-create-magazine-style-horizontal-drop-down-menu-for-wordpress-categories-pages.html</link>
		<comments>http://webmasters-blog.com/howto-create-magazine-style-horizontal-drop-down-menu-for-wordpress-categories-pages.html#comments</comments>
		<pubDate>Wed, 15 Apr 2009 13:26:46 +0000</pubDate>
		<dc:creator>Raman</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://webmasters-blog.com/?p=285</guid>
		<description><![CDATA[WordPress theme&#8217;s trends changes every few months. So you get to see new styles for WordPress every 6-8 months. These...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-286" title="menu-horizontal-wordpress-categories" src="http://webmasters-blog.com/wp-content/uploads/2009/04/menu-horizontal-wordpress-categories.jpg" alt="menu-horizontal-wordpress-categories" width="550" height="122" /></p>
<p>WordPress theme&#8217;s trends changes every few months. So you get to see new styles for WordPress every 6-8 months. These days there is a trend of displaying your categories and subcategories or pages and subpages in a drop-down horizontal menu in header.</p>
<p>Though many wordpress themes come with built-in simple horizontal menu, i.e. there is no drop-down facility, you can easily put advanced categories/pages menu in your header.</p>
<p>Just follow these simple steps, and you will have a horizontal drop-down menu in your blog&#8217;s header.</p>
<p><strong>STEP I.</strong><br />
In the first step we&#8217;ll get WordPress to display the categories/pages list. For this just paste the following code in the <em>header.php</em> file of your theme.<br />
<blockquote>&lt;ul id=&#8221;nav2&#8243; class=&#8221;clearfloat&#8221;&gt;<br />
	&lt;li&gt;&lt;a href=&#8221;&lt;?php echo get_option(&#8216;home&#8217;); ?&gt;/&#8221; class=&#8221;on&#8221;&gt;Home&lt;/a&gt;&lt;/li&gt;</p>
<p> 	&lt;?php wp_list_categories(&#8216;orderby=name&amp;exlude=181&amp;title_li=&#8217;);<br />
 	$this_category = get_category($cat);<br />
 	if (get_category_children($this_category-&gt;cat_ID) != &#8220;&#8221;) {<br />
 		echo &#8220;&lt;ul&gt;&#8221;;<br />
wp_list_categories(&#8216;orderby=id&amp;show_count=0&amp;title_li=&amp;use_desc_for_title=1&amp;child_of=&#8217;.$this_category-&gt;cat_ID);<br />
 		echo &#8220;&lt;/ul&gt;&#8221;;<br />
 	}<br />
	?&gt;<br />
&lt;/ul&gt;</p></blockquote>
<p><strong>STEP II.</strong><br />
Now we should style our menu as per our needs, for this we need to add this to our stylesheet. Just paste this in your <em>style.css</em> file. We are not using any javascript for now, as we can get an advanced horizontal drop-down menu, without using javascript, But to ensure it&#8217;s compatibility with IE6 we&#8217;ll need to add the javascript, which I had described later.<br />
<blockquote>#nav2{<br />
        background-color: #202020;<br />
        display: block;<br />
        font-size:1.1em;<br />
        height:50px;<br />
        width:100%;<br />
}</p>
<p>#nav2, #nav2 ul {<br />
	line-height: 1;<br />
	list-style: none;<br />
}</p>
<p>#nav2 a ,#nav2 a:hover{<br />
	border:none;<br />
	display: block;<br />
	text-decoration: none;<br />
}</p>
<p>#nav2 li {<br />
	float: left;<br />
	list-style:none;<br />
}</p>
<p>#nav2 a,#nav2 a:visited {<br />
	color:#109dd0;<br />
	display:block;<br />
	font-weight:bold;<br />
	padding:6px 12px;<br />
}</p>
<p>#nav2 a:hover, #nav2 a:active {<br />
	color:#fff;<br />
	text-decoration:none<br />
}	</p>
<p>#nav2 li ul {<br />
	border-bottom: 1px solid #a9a9a9;<br />
	height: auto;<br />
	left: -999em;<br />
	position: absolute;<br />
	width: 900px;<br />
	z-index:999;<br />
}</p>
<p>#nav2 li li {<br />
	width: auto;<br />
}</p>
<p>#nav2 li li a,#nav2 li li a:visited {<br />
        color:#109dd0;<br />
	font-weight:normal;<br />
	font-size:0.9em;<br />
}</p>
<p>#nav2 li li a:hover,#nav2 li li a:active {<br />
	color:#fff;<br />
}	</p>
<p>#nav2 li:hover ul, #nav2 li li:hover ul, #nav2 li li li:hover ul, #nav2 li.sfhover ul, #nav2 li li.sfhover ul, #nav2 li li li.sfhover ul {<br />
	left: 30px;<br />
}</p></blockquote>
<p>Once added the above code to your stylesheet, you are done with horizontal drop-down menu for all browserss except IE6. To ensure its compatibility with IE6 just place this javascript snippet as an external file or in the <em>header.php</em>file.<br />
<blockquote>&lt;!&#8211;//&#8211;&gt;&lt;![CDATA[//&gt;&lt;!--</p>
<p>sfHover = function() {<br />
	var sfEls = document.getElementById("nav2").getElementsByTagName("LI");<br />
	for (var i=0; i&lt;sfEls.length; i++) {<br />
		sfEls[i].onmouseover=function() {<br />
			this.className+=&#8221; sfhover&#8221;;<br />
		}<br />
		sfEls[i].onmouseout=function() {<br />
			this.className=this.className.replace(new RegExp(&#8221; sfhover\\b&#8221;), &#8220;&#8221;);<br />
		}<br />
	}<br />
}<br />
if (window.attachEvent) window.attachEvent(&#8220;onload&#8221;, sfHover);</p>
<p>//&#8211;&gt;&lt;!]]&gt;</p></blockquote>
<p>Once done, your WordPress blog now have an advanced horizontal drop-down menu compatible with all browsers.</p>

	Tags: <a href="http://webmasters-blog.com/tag/how-to-wordpress" title="How to" rel="tag">How to</a>, <a href="http://webmasters-blog.com/tag/menu" title="menu" rel="tag">menu</a>, <a href="http://webmasters-blog.com/tag/navigation" title="navigation" rel="tag">navigation</a>, <a href="http://webmasters-blog.com/tag/wordpress" title="Wordpress" rel="tag">Wordpress</a><br />
]]></content:encoded>
			<wfw:commentRss>http://webmasters-blog.com/howto-create-magazine-style-horizontal-drop-down-menu-for-wordpress-categories-pages.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

