1

I tried to add arrow down when the menu has a sub-menus. But the down arrow not showing up. Please help me.

Here's the link: http://bit.ly/1UH4FlT

Currently using this script that I found somewhere.

function add_menu_parent_class( $items ) {
 $parents = array();
foreach ( $items as $item ) {
 if ( $item->current_page_ancestor && $item-> current_page_ancestor> 0 ) {
  $parents[] = $item->current_page_ancestor;
 }
}
foreach ( $items as $item ) {
 if ( in_array( $item->ID, $parents ) ) {
  $item->classes[] = 'menu-item-has-children';
 }
} 
 return $items;
}
add_filter( 'wp_nav_menu_objects', 'add_menu_parent_class' );

And I added this css

#site-navigation .menu > ul > li.menu-item-has-children > a:before {
color: #fff;
content: "\f107";
font-family:FontAwesome;
font-size: 10px;
vertical-align: 1px;
}
#site-navigation .menu > ul > li > li.menu-item-has-children > a:after {
color: #222;
content: ""\f105"";
font-family:FontAwesome;
font-size: 10px;
vertical-align: 1px;
}
1

Add below code

#site-navigation .menu > ul > li.menu-item-has-children > a::after {
content: '\f107';
font-family: FontAwesome;
font-size: 10px;
margin-left: 10px;
vertical-align: 1px;
}


#site-navigation .menu > ul > li > ul > li.menu-item-has-children > a::after {
color: rgb(34, 34, 34);
content: '\f105';
font-family: FontAwesome;
font-size: 10px;
vertical-align: 1px;
float: right;
}

Add 3rd level navigation. If you face any issues, reply.

  • still the arrow down is not showing up. Do you think there's some issue in my function? – user3098728 Aug 17 '15 at 1:43
1

You Add Two time ("") Quote in you css see below

Replace

content: ""\f105"";

To

content: "\f105";

And Check Again

  • still arrow down no displaying – user3098728 Aug 17 '15 at 1:43
0

you can add a arrow next to the menu label with the free plugin "Menu Icons". go in "extensions" -> "add new" and search "Menu Icons"

after activating this plugin, go to the menu editor and at each menu element you can choose a icon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.