Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Adds a "has-children" class to menu items that have children. Posted by @chipbennet to the Theme Reviewers Mail List.
function oenology_add_menu_parent_class( $items ) {
$parents = array();
foreach ( $items as $item ) {
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) {
$parents[] = $item->menu_item_parent;
foreach ( $items as $item ) {
if ( in_array( $item->ID, $parents ) ) {
$item->classes[] = 'has-children';
return $items;
add_filter( 'wp_nav_menu_objects', 'oenology_add_menu_parent_class' );
krulkip commented Sep 19, 2013

The arrows are working fine, but i had to make my menu larger and now the secondary dropdown overlaps with the first. Can you halp me find the CSS code to correct this please. ie how do you move the secondary dropdown in relation to the first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.