nav menu – all sub items add target="_blank"
-
I have a menu top level item that I want all sub items to open in a new window.
I guess this will need a php check if menu item == “abc” then add target=”_blank” to the url … and i guess this will go in header.php in my child theme ?
This is just a guess. I can edit code but I’m not a true coder, I’m still learning!I see this code from dev menu help but I don’t know how to use it for my needs
function wpdocs_special_nav_class( $classes, $item ) { if ( is_single() && 'Blog' == $item->title ) { $classes[] = "special-class"; } return $classes; } add_filter( 'nav_menu_css_class' , 'wpdocs_special_nav_class' , 10, 2 );
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘nav menu – all sub items add target="_blank"’ is closed to new replies.