Skip to content

Instantly share code, notes, and snippets.

@nfreader
Created February 6, 2012 16:54
Show Gist options
  • Save nfreader/1753281 to your computer and use it in GitHub Desktop.
Save nfreader/1753281 to your computer and use it in GitHub Desktop.
<ul id="menu-header" class="nav menu">
<li id="menu-item-4" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-4">
<a href="http://minecraft.nfreader.net/wordpress/">Index</a>
</li>
<li id="menu-item-49" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-49">
<a href="http://minecraft.nfreader.net/wordpress/?page_id=36">Rules and other Info</a>
</li>
<li id="menu-item-8" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8">
<a href="http://minecraft.nfreader.net/wordpress/?page_id=6">Status</a>
</li>
<li id="menu-item-27" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27">
<a href="http://minecraft.nfreader.net/wordpress/?page_id=15">Maps</a>
</li>
<li id="menu-item-79" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Infrastructure</a>
<ul class="dropdown-menu">
<li id="menu-item-74" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item first-page-item last-page-item page-item-68 current_page_item menu-item-74">
<a href="http://minecraft.nfreader.net/wordpress/?page_id=68">Overview</a>
</li>
<li id="menu-item-75" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-75">
<a href="http://minecraft.nfreader.net/wordpress/?page_id=72">HTA Railroad</a>
</li>
<li id="menu-item-76" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-76">
<a href="http://minecraft.nfreader.net/wordpress/?page_id=70">MTG</a>
</li>
</ul>
</li>
</ul>
function add_dropdowns($output) {
$output= preg_replace('/class="sub-menu"/', 'class="dropdown-menu"', $output, 1);
$output= preg_replace('/id="menu-item-79"/', 'id="menu-item-79" class="dropdown"', $output, 1);
$output= preg_replace('/href="#"/', 'href="#" class="dropdown-toggle" data-toggle="dropdown"', $output, 1);
return $output;
}
add_filter('wp_nav_menu', 'add_dropdowns');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment