开发者 | zackdesign |
---|---|
更新时间 | 2012年5月7日 13:08 |
捐献地址: | 去捐款 |
PHP版本: | 3.0 及以上 |
WordPress版本: | 3.3.2 |
/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
<?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' => '' ) ); } ?>
(Un)fortunately the Wordpress nav menu system doesn't use the browser hacks Stu Nicholl used. There are many other CSS navigation menus out there these days, do a quick Google search, pop it into your own menu.css file, and target the correct class. It's easy to drop over the top!
That's what I'm here for. I do Wordpress sites for many people in a professional capacity and can do the same for you. Check out www.zackdesign.biz
You need PHP 5 to run this
I left dynamic menu width code in until a replacement CSS menu can be found... it should not break existing dynamic CSS, but you can no longer change the options in the WP Settings.
Contact me to suggest a good alternative, and if you need to change any of the options found in the css_dropdownmenu_css
function use functions.php and this as a guide: http://codex.wordpress.org/Function_Reference/update_option