{"id":14065,"date":"2011-07-16T21:16:52","date_gmt":"2011-07-16T21:16:52","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/dropdown-menus\/"},"modified":"2013-01-16T18:15:07","modified_gmt":"2013-01-16T18:15:07","slug":"dropdown-menus","status":"publish","type":"plugin","link":"https:\/\/ssw.wordpress.org\/plugins\/dropdown-menus\/","author":65781,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"1.0","tested":"3.5.2","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"Dropdown Menus","header_author":"Robert O'Rourke @ interconnect\/it","header_description":"","assets_banners_color":"","last_updated":"2013-01-16 18:15:07","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/interconnectit.com\/?p=2190","header_author_uri":"http:\/\/interconnectit.com","rating":4.4,"author_block_rating":0,"active_installs":300,"downloads":31277,"num_ratings":5,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":"1","4":"1","5":"3"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[5874,231,841,1753,566],"plugin_category":[43],"plugin_contributors":[79639],"plugin_business_model":[],"class_list":["post-14065","plugin","type-plugin","status-publish","hentry","plugin_tags-dropdowns","plugin_tags-menus","plugin_tags-mobile","plugin_tags-navigation","plugin_tags-ui","plugin_category-customization","plugin_contributors-sanchothefat","plugin_committers-sanchothefat"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/dropdown-menus.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Sometimes for mobile design or more generally small-screen design it can be beneficial to save space by using a dropdown for your navigation.<\/p>\n\n<p>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.<\/p>\n\n<h4>Usage<\/h4>\n\n<p>If you are using the plugin with a theme you can use the function <code>dropdown_menu()<\/code> in place of calls to <code>wp_nav_menu()<\/code>.<\/p>\n\n<p>The <code>dropdown_menu()<\/code> function takes the same arguments as <code>wp_nav_menu()<\/code> with the addition of three extras:<\/p>\n\n<pre><code>&lt;?php\ndropdown_menu( array(\n\n    \/\/ You can alter the blanking text eg. \"- Menu Name -\" using the following\n    'dropdown_title' =&gt; '-- Main Menu --',\n\n    \/\/ indent_string is a string that gets output before the title of a\n    \/\/ sub-menu item. It is repeated twice for sub-sub-menu items and so on\n    'indent_string' =&gt; '- ',\n\n    \/\/ indent_after is an optional string to output after the indent_string\n    \/\/ if the item is a sub-menu item\n    'indent_after' =&gt; ''\n\n) );\n?&gt;\n<\/code><\/pre>\n\n<p>You can extend and alter the output of the dropdowns using the output filters available in the code.<\/p>\n\n<p>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 (<code>.menu-item-depth-1<\/code> for example) aswell the usual <code>.current-menu-item<\/code> and <code>.current-menu-ancestor<\/code> classes.<\/p>\n\n<h4>Filters\/Hooks<\/h4>\n\n<p><strong>dropdown_blank_item_text<\/strong><\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'dropdown_blank_item_text', 10, 2 );\nfunction my_dropdown_blank_text( $title, $args ) {\n    return __( '- Browse -' );\n}\n?&gt;\n<\/code><\/pre>\n\n<p>If you want to show the menu title as the blank item text use the follwing code:<\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'dropdown_blank_item_text', 'dropdown_menu_use_menu_title', 10, 2 );\nfunction dropdown_menu_use_menu_title( $title, $args ) {\n    return '- ' . $args-&gt;menu-&gt;name . ' -';\n}\n?&gt;\n<\/code><\/pre>\n\n<p><strong>dropdown_menus_indent_string<\/strong><\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'dropdown_menus_indent_string', 10, 4 );\nfunction my_dropdown_indent_string( $indent_string, $item, $depth, $args ) {\n    return str_repeat( '&amp;nbsp;&amp;nbsp;', $depth );\n}\n?&gt;\n<\/code><\/pre>\n\n<p><strong>dropdown_menus_indent_after<\/strong><\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'dropdown_menus_indent_after', 10, 4 );\nfunction my_dropdown_indent_after( $indent_after, $item, $depth, $args ) {\n    return '-';\n}\n?&gt;\n<\/code><\/pre>\n\n<p><strong>dropdown_menus_class<\/strong><\/p>\n\n<p>Use this if you find you get class name or CSS conflicts, for example with Twitter Bootstrap.<\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'dropdown_menus_class', create_function( '$c', 'return \"my-dropdown-menu-class\";' ) );\n?&gt;\n<\/code><\/pre>\n\n<p><strong>dropdown_menus_select_current<\/strong><\/p>\n\n<p>Use this filter to stop the output of the <code>selected=\"selected\"<\/code> attribute. Useful if you prefer to show the blank option on every page.<\/p>\n\n<pre><code>&lt;?php\nadd_filter( 'dropdown_menus_select_current', create_function( '$bool', 'return false;' ) );\n?&gt;\n<\/code><\/pre>\n\n<h4>Can I make sure this plugin is available to my theme?<\/h4>\n\n<p>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.<\/p>\n\n<p>If you place the plugin folder into your theme's directory you would use the following code in your functions.php file:<\/p>\n\n<pre><code>&lt;?php\nif ( ! function_exists( 'dropdown_menu' ) )\n    include( 'dropdown-menus\/dropdown-menus.php' );\n?&gt;\n<\/code><\/pre>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Added check for dropdown_menu being declared already to avoid issues if plugin is used and theme has it embedded<\/li>\n<\/ul>\n\n<h4>0.9<\/h4>\n\n<ul>\n<li>Fixed debug code left in the JS that was affecting IE9 and below. Rookie mistake - really sorry folks.<\/li>\n<\/ul>\n\n<h4>0.8<\/h4>\n\n<ul>\n<li>Dropdown selector explicitly set to work on  elements to avoid conflict with twitter bootstrap<\/li>\n<li>Added a filter to choose whether or not to use the selected attribute<\/li>\n<\/ul>\n\n<h4>0.7<\/h4>\n\n<ul>\n<li>Added a filter for the dropdown menu class name as it very generic and can cause conflicts<\/li>\n<\/ul>\n\n<h4>0.6<\/h4>\n\n<ul>\n<li>Fixed the echo argument, thanks to squingynaut for the tip<\/li>\n<li>Fixed the ability to call the menu via the theme location name only<\/li>\n<\/ul>\n\n<h4>0.5<\/h4>\n\n<ul>\n<li>Better cross browser &amp; old browser support using getElementsByClassName by Rob Nyman (http:\/\/code.google.com\/p\/getelementsbyclassname\/)<\/li>\n<\/ul>\n\n<h4>0.4<\/h4>\n\n<ul>\n<li>Made the menu use the menu title as the blanking option text<\/li>\n<li>Fixed the menu title usage for dropdowns called via a theme location by populating the menu object<\/li>\n<\/ul>\n\n<h4>0.3<\/h4>\n\n<ul>\n<li>Improved the filter on the blanking item text by passing in the menu $args<\/li>\n<li>Added a dropdown_title argument to alter the blanking item text from its default<\/li>\n<li>changed the standard widget class name to 'dropdown-menu-widget'<\/li>\n<\/ul>\n\n<h4>0.2<\/h4>\n\n<ul>\n<li>Removed optgroup tags altogether as nested optgroups are invalid markup<\/li>\n<li>Added class name for targetting items by depth<\/li>\n<li>Added configurable indentation text to indicate visually the depth of an item in the menu<\/li>\n<li>Added extra filters to provide fine-grained control for developers<\/li>\n<\/ul>","raw_excerpt":"Display your WordPress menus as a dropdown select box. Great for mobile designs.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/14065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=14065"}],"author":[{"embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/sanchothefat"}],"wp:attachment":[{"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=14065"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=14065"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=14065"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=14065"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=14065"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ssw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=14065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}