Dropdown Menus
Display your WordPress menus as a dropdown select box. Great for mobile designs.
The facts
- Rating
- 4.4★ from 5
- Active installs
- 300+
- Price
- Free
- Last updated
- 16 Jan 2013
- Added
- Jul 2011
- Requires WP
- 3.0
- Tested up to
- WP 3.5.2
- Downloads
- 31,519
Our analysis
AI-assistedDropdown Menus is a WordPress plugin designed to help you create dropdown navigation menus for mobile or small-screen designs. It allows you to display custom menus as dropdowns using either a widget or a function call, making it adaptable for various themes.
You can use the `dropdown_menu()` function in place of the standard `wp_nav_menu()`, with additional options for customisation. The plugin also includes filters and hooks for further extending the output and styling of the dropdown menus.
Best for: Websites that require space-saving navigation solutions for mobile users.
What it does well
- ✓Enables dropdown navigation for mobile and small screens
- ✓Customisable through function calls and filters
- ✓Compatible with any theme that supports function calls
Where it falls short
- •Last updated in January 2013, may not support newer WordPress features
- •Limited information available on additional features
Verdict
Dropdown Menus provides a straightforward way to implement dropdown navigation, but its age may limit compatibility with modern WordPress versions.
From the developer
Robert O'Rourke's own description of Dropdown Menus, lightly tidied.
Sometimes for mobile design or more generally small-screen design it can be beneficial to save space by using a dropdown for your navigation.
This plugin provides a way to display your custom menus as dropdowns either using a widget or a function call and can be used as an include in any theme.
Usage
If you are using the plugin with a theme you can use the function dropdown_menu() in place of calls to wp_nav_menu().
The dropdown_menu() function takes the same arguments as wp_nav_menu() with the addition of three extras:
<?php
dropdown_menu( array(
// You can alter the blanking text eg. "- Menu Name -" using the following
'dropdown_title' => '-- Main Menu --',
// indent_string is a string that gets output before the title of a
// sub-menu item. It is repeated twice for sub-sub-menu items and so on
'indent_string' => '- ',
// indent_after is an optional string to output after the indent_string
// if the item is a sub-menu item
'indent_after' => ''
) );
?>
You can extend and alter the output of the dropdowns using the output filters available in the code.
There are also plenty of styling hooks like in the standard list type menus with the addition of classes for targetting items at a certain depth in the menu (.menu-item-depth-1 for example) aswell the usual .current-menu-item and .current-menu-ancestor classes.
Filters/Hooks
dropdown_blank_item_text
<?php
add_filter( 'dropdown_blank_item_text', 10, 2 );
function my_dropdown_blank_text( $title, $args ) {
return __( '- Browse -' );
}
?>
If you want to show the menu title as the blank item text use the follwing code:
<?php
add_filter( 'dropdown_blank_item_text', 'dropdown_menu_use_menu_title', 10, 2 );
function dropdown_menu_use_menu_title( $title, $args ) {
return '- ' . $args->menu->name . ' -';
}
?>
dropdown_menus_indent_string
<?php
add_filter( 'dropdown_menus_indent_string', 10, 4 );
function my_dropdown_indent_string( $indent_string, $item, $depth, $args ) {
return str_repeat( ' ', $depth );
}
?>
dropdown_menus_indent_after