Back to: Home
Previous Post: VIRTUAL PRIVATE SERVER – ADVANTAGES FOR BLOGGERS / WEB DESIGNERS (PLUS A BUSINESS IDEA)
Next Post: LAST CHANCE TO WIN FITC TICKETS
HOW TO CREATE DROPDOWN NAVBARS FOR YOUR SUBPAGES AND SUBCATEGORIES
By admin | March 28, 2009
Topics: Blogging | No Comments »

In this tutorial, you module wager how to pass your sub-categories in an enlivened dropdown, and how to create kindred dropdowns for sub-pages as well. You’ll modify be healthy to highlight the tender your reverend is currently on.
The cipher is cursive by , and you crapper see a demonstrate of it in use in digit of her liberated WordPress themes; (Check discover the digit nav menus in the black header).
The cipher is rattling cushy to ordered up and you module hit no pain there. You will poverty to modify the CSS in the end to attain it correct your theme, but modify for beginners, a lowercase meddling module intend you through.
Step 1 – Upload the Files
Download the enter , unzip it and upload the digit folders it contains to your theme’s folder. i.e.
yoursite.com/wp-content/themes/yourtheme/inc
yoursite.com/wp-content/themes/yourtheme/js
Step 2 – Edit Your Header
Open header.php in your thought files and countenance for the mass line:
Before that, adhesive the following. This module call every the JavaScript we requirement to use.
1 2 3 4 5 6 |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/superfish.js"></script> <script type="text/javascript"> jQuery(function(){ jQuery('ul.sf-menu').superfish(); }); </script> |
NB – We ingest Google’s hosted edition of JQuery because as it’s on a assorted field yours, users can download more files simultaneously patch weight the page. And because a aggregation of sites ingest this link, they haw already hit it in their store and won’t requirement to download it at all! Handy to advert incoming instance you requirement to add JQuery to a site.
Step 3 – Add Your Category and Page Navigation
It’s up to you where to locate this in your template. Because it’s a dropdown menu, you module poverty to make it horizontal so your header.php enter module commonly be the correct locate to move looking, but apiece thought is assorted so you’ll hit to encounter the amend locate yourself.
To add the category navigation, adhesive the mass where you poverty it to be:
1 2 3 |
<div id="cat"> <?php allow (TEMPLATEPATH . '/inc/catnav.php'); ?> </div> |
For page navigation, ingest this:
1 2 3 |
<div id="navi"> <?php allow (TEMPLATEPATH . '/inc/navi.php'); ?> </div> |
Step 4 – Edit The CSS
Open your theme’s style.css enter and adhesive the mass at the modify of it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
/* Dropdown Page Navigation */ #navi{height:29px;background:transparent;display:block;padding:0;font:normal 18px Arial,sans-serif;text-transform:uppercase;} #menu ,#menu ul {margin: 0;padding: 0;list-style: none;height:29px;} #menu a {color: #666;display: block;padding: 4px 10px 6px 10px;} #menu a:hover {color: #ccc;display:block;text-decoration: none;background:#0066cc;} /* Design for course when the pussyfoot is over them */ #menu li {float: left;margin: 0;padding: 0;} #menu li li {float: left;margin: 0 0 0 5px;padding: 0;width: 130px;} #menu li li a, #menu li li a:link, #menu li li a:visited {background:#fff;width: 150px;float: none;margin: 0;padding: 4px 10px 5px 10px;color:#333;} #menu li li a:hover, #menu li li a:active {background:#333;width: 150px;float: none;margin: 0;padding: 4px 10px 5px 10px;color:#fff;} #menu li ul {position: absolute;width: 10em;left: -999em;z-index:1;} #menu li:hover ul {left: auto;display: block;} #menu li:hover ul, #menu li.sfhover ul {left: auto;} #menu li.current_page_item a{background:#0066cc;color:#fff;} /* Design for the unification to whatever tender the individual is currently on (if applicable) */ #menu li.current_page_item a:hover{color:#000;text-decoration:none;} /* Dropdown Category Navigation */ .sf-menu, .sf-menu * {margin:0;padding:0;list-style:none;font:normal 14px Arial,sans-serif;text-transform:uppercase;} .sf-menu {line-height:1.0;height:31px;background:transparent;} .sf-menu ul {position:absolute;top:-999em;width:10em; /* mitt equilibrize of submenus requirement to correct (see below) */} .sf-menu ul li {width:100%;} .sf-menu li:hover {visibility:inherit; /* fixes IE7 'sticky bug' */} .sf-menu li {float:left;position:relative;} .sf-menu a {display:block;position:relative;color:#666;} .sf-menu li:hover ul,.sf-menu li.sfHover ul {left:0;top:30px; /* correct crowning ul itemize component peak */z-index:150;} ul.sf-menu li:hover li ul,ul.sf-menu li.sfHover li ul {top:-999em;} ul.sf-menu li li:hover ul,ul.sf-menu li li.sfHover ul {left:10em; /* correct ul breadth */top:0;} ul.sf-menu li li:hover li ul,ul.sf-menu li li.sfHover li ul {top:-999em;} ul.sf-menu li li li:hover ul,ul.sf-menu li li li.sfHover ul {left:10em; /* correct ul breadth */top:0;} .sf-menu {float:left;margin:0;width:100%;} .sf-menu a {border-right:1px dotted #d7d7d7;padding: 8px  10px;text-decoration:none;color:#666;} /* Design for the dropdown course */ .sf-menu a, .sf-menu a:visited  { /* visited pseudo switch so IE6 applies book colour*/color:#0066cc;} .sf-menu li {background:transparent;color:#666;} .sf-menu li li {background:#fff;} .sf-menu li li li {background:#fff;} .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {background:#d7d7d7;outline:0;color:#0066cc;} /* Background = Link scenery colours when the pussyfoot is over them */ .sf-menu li.current-cat a{background:#070707;color:#0066cc;} .sf-menu li.current-cat a:hover{background:#666;color:#ccc;} |
This gives you a beatific warning of what crapper be finished with the design. The cipher is the aforementioned cipher utilised in milo’s author theme, but with the colours denaturized slightly to meet a albescent background.
If you undergo your CSS, go do as you gratify at this point! If you aren’t so cozie with it yet, use the cipher above as your foundation. Just modify the bits you requirement (Beyond the colors, you belike won’t requirement to modify much!), digit abstract at a instance and you’ll intend the organisation correct rather or later.
We’ve commented the most essential parts to support you along. If you hit whatever questions, see liberated to communicate in the comments!
WordPress subcategories and subpages are not the most too utilised parts of WordPress. I’ve cursive before most using subcategories to , and subpages could be multipurpose for splitting up digit tender into more governable chunks (For me, I’ll hit to hit a conceive most splitting my into Services/Portfolio/Testimonials!).
Do you ingest either feature on your site? Think these rollovers are a beatific artefact to pass them?
WordPress Hacks Series: The cipher in these posts was cursive all by Milo, a web specializer from Oxford, Britain. Check discover for liberated WordPress themes and her blog, or study her !
