Skip to content

Instantly share code, notes, and snippets.

Created March 21, 2013 04:22
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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' );
Copy link

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