Use WordPress' nav menu system to create left/right widget flyouts, with support for Superfish
/wp-content/plugins/ directory or install it from WordPress.org's Plugin directory inside your WordPress installation.<?php
if (class_exists('CSSDropDownMenu'))
{
$myMenu = new CSSDropDownMenu();
/* Extra options here, like so: $myMenu->orientation="top"; */
$myMenu->show();
}
?>
You can place the above code anywhere in your theme, not just the header. Options available to you are:
$myMenu->orientation - Values are 'top', 'right', 'left' - default is 'top'
$myMenu->name - WordPress menu id, slug, or name
$myMenu->container_class - the class that is applied to the container
$myMenu->theme_location - The location in the theme to be used (defined via register_nav_menu)
$myMenu->menu_class - CSS class to be used for the ul element which forms the menu
These are a subset of the options given here: http://codex.wordpress.org/Function_Reference/wp_nav_menu
If you want to show the widget in the header of your theme, add a sidebar to your header.php file and update your functions.php file to add a new sidebar there.
PHP for your sidebar.php file in your WordPress theme:
<?php if ( function_exists ( dynamic_sidebar('menu') ) ) : dynamic_sidebar ('menu'); endif; ?>
Example PHP for your functions file:
<?php
if ( function_exists ('register_sidebar')) {
register_sidebar( array(
'name' => __('Menu', 'menu'),
'id' => 'menu',
'description' => __('Shows a dropdown menu in the header.', 'menu'),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
) );
}
?>
The plugin defines its own menu.css in your theme's header. If you have your own menu.css file in your theme folder the plugin will check for that and load that for you automatically. It may be easier to simply copy across menu.css from the plugin folder and use that as the basis for your own. Or, browse the internet for unordered CSS list menu styles. Stu's site is a good start.
You can also activate the JS addon plugin to use Superfish javascript. This plugin uses its own Superfish CSS which you can find in the plugin js/superfish directory. It has been modified for use with WordPress. Place superfish.css into your own theme folder to avoid having your CSS overwritten on a plugin update! It's also possible to use other Superfish menu variants but you will need to edit and include them yourself using functions.php in your theme folder. Please also note that right/left widget items won't work with this menu type installed right now.
If you get 'broken image links' in IE it's because the background dropdown images in your menu.css file are set to Stu's original ones. You will need to change these.
Requires: 3.0 or higher
Compatible up to: 3.3.2
Last Updated: 2012-5-7
Downloads: 134,583
0 of 1 support threads in the last two months have been resolved.
Got something to say? Need help?