Skip to content

Instantly share code, notes, and snippets.

@nhahaag
Last active February 14, 2019 22:16
Show Gist options
  • Save nhahaag/aabf8fa96a5d0e53e1dd794bd6ba0936 to your computer and use it in GitHub Desktop.
Save nhahaag/aabf8fa96a5d0e53e1dd794bd6ba0936 to your computer and use it in GitHub Desktop.
<?php
function ngstyle_child_menu_items($item_output, $item, $depth, $args) {
if ($args->theme_location != 'main' && $args->theme_location != 'front') {
return $item_output;
}
$classes = $item->classes;
$new_output = $item_output;
$new_output .= '<div class="menu-icon menu-icon--' . $classes[0] . '">';
$new_output .= get_icon($classes[0]);
$new_output .= '</div>';
return $new_output;
}
add_filter('walker_nav_menu_start_el', 'ngstyle_child_menu_items', 10, 4);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment