Last active
September 29, 2017 19:18
-
-
Save narkan/7eb2997e272ead3c580db9f26f2d3adb to your computer and use it in GitHub Desktop.
Foundation 6 navigation menu for Wordpress: functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/***** FUNCTIONS.PHP **********/ | |
class F6_DRILL_MENU_WALKER extends Walker_Nav_Menu { | |
/* | |
* Add vertical menu class | |
*/ | |
function start_lvl( &$output, $depth = 0, $args = array() ) { | |
$indent = str_repeat( "\t", $depth ); | |
$output .= "\n$indent<ul class=\"vertical menu\">\n"; | |
} | |
} | |
function f6_drill_menu_fallback( $args ) { | |
/* | |
* Instantiate new Page Walker class instead of applying a filter to the | |
* "wp_page_menu" function in the event there are multiple active menus in theme. | |
*/ | |
$walker_page = new Walker_Page(); | |
$fallback = $walker_page->walk( get_pages(), 0 ); | |
$fallback = str_replace( "children", "children vertical menu", $fallback ); | |
echo '<ul class="vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown" style="width: 100%;">' . $fallback . '</ul>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment