Skip to content
Permalink
Browse files

Add new wf-menu-walkers.php file

This is where more custom menu walkers will be added in the future. wfx_walker_submenu_div is the first - it wraps nested sub-lists in a div for advanced styling/layout.
  • Loading branch information...
Jonnyauk committed Aug 8, 2019
1 parent 3bd60bb commit c7e64a28b8c657d445f78880458c507807dc2f19
Showing with 50 additions and 5 deletions.
  1. +6 −5 wf-includes/wf-engine.php
  2. +44 −0 wf-includes/wf-menu-walkers.php
@@ -1,9 +1,10 @@
<?php
load_template(get_template_directory() . '/wf-config.php');
load_template(WF_INCLUDES_DIR . '/wf-version.php');
load_template(WF_INCLUDES_DIR . '/wf-helper-functions.php');
load_template(WF_INCLUDES_DIR . '/wf-data-management.php');
load_template(WF_INCLUDES_DIR . '/wf-theme-support.php');
load_template( get_template_directory() . '/wf-config.php' );
load_template( WF_INCLUDES_DIR . '/wf-version.php' );
load_template( WF_INCLUDES_DIR . '/wf-helper-functions.php' );
load_template( WF_INCLUDES_DIR . '/wf-data-management.php' );
load_template( WF_INCLUDES_DIR . '/wf-theme-support.php' );
load_template( WF_INCLUDES_DIR . '/wf-menu-walkers.php' );
//// FUNCTIONALITY REQUIRED BEFORE INIT HOOK
@@ -0,0 +1,44 @@
<?php
/**
* Custom menu walker Classes to manipluate menu output
*
* @since 2.6
*
*/
/**
*
* Custom menu walker
* Adds div around sub-menu list items.
*
* @since 2.6
* @version 2.6
*
*/
class wfx_walker_submenu_div extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n"
. $indent
. '<div class="sub-menu-wrap">'
. '<ul class="sub-menu">'
. "\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= $indent
. '</ul>'
. '</div>'
. "\n";
}
}

0 comments on commit c7e64a2

Please sign in to comment.
You can’t perform that action at this time.