> Dropdown Menus wordpress plugin resources analysis

Dropdown Menus wordpress plugin resources analysis

Download This Plugin
Download Elegant Themes
Name Dropdown Menus
Version 1.0
Author Robert O'Rourke @ interconnect/it
Rating 86
Last updated 2013-01-16 06:15:00
Downloads
26213
Download Plugins Speed Test plugin for Wordpress

Home page

Delta: 0%

Post page

Delta: 0%
Dropdown Menus plugin has no negative impact on PageSpeed score.

Home page PageSpeed score has been degraded by 0%, while Post page PageSpeed score has been degraded by 0%

Dropdown Menus plugin added 1 kB of resources to the Home page and 1 kB of resources to the sample Post page.

Dropdown Menus plugin added 0 new host(s) to the Home page and 0 new host(s) to the sample Post page.

Great! Dropdown Menus plugin ads no tables to your Wordpress blog database.

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( '&nbsp;&nbsp;', $depth );
}
?>

dropdown_menus_indent_after

<?php
add_filter( 'dropdown_menus_indent_after', 10, 4 );
function my_dropdown_indent_after( $indent_after, $item, $depth, $args ) {
    return '-';
}
?>

dropdown_menus_class

Use this if you find you get class name or CSS conflicts, for example with Twitter Bootstrap.

<?php
add_filter( 'dropdown_menus_class', create_function( '$c', 'return "my-dropdown-menu-class";' ) );
?>

dropdown_menus_select_current

Use this filter to stop the output of the selected="selected" attribute. Useful if you prefer to show the blank option on every page.

<?php
add_filter( 'dropdown_menus_select_current', create_function( '$bool', 'return false;' ) );
?>

Can I make sure this plugin is available to my theme?

If your theme requires this plugin to be available it will work as a simple include. Just place the plugin into your theme directory and include dropdown-menus.php from your functions.php file.

If you place the plugin folder into your theme's directory you would use the following code in your functions.php file:

<?php
if ( ! function_exists( 'dropdown_menu' ) )
    include( 'dropdown-menus/dropdown-menus.php' );
?>
Resources added by plugin to Home page/Post page in kB
Total size of resources for Home page/Post page in kB
Random Theme Tests
Admired screenshot

Admired

by: bradthomas127

143064
100%
Camp screenshot

Camp

by: bestwebsoft

7823
0%