aquila icon indicating copy to clipboard operation
aquila copied to clipboard

Nav Menu Open Link in a new tab does not work

Open adrian200065 opened this issue 2 years ago • 1 comments

I love your nav menu code because it make it really simple to setup drop-down menu. However, "Open link in a new tab doesn't work" and I have spent hours trying to figure it out. If I disabled your menu code and revert to standard menu setup the "Open link in a new tab" works. I haven't card anything with the code except for the CSS. Do you have any suggestions?

I try this code $target= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ' target=”_blank" '; and then this to the anchor link but it is opening all the links into a new tab. I just need to open links that I set in the menu open to option to open in new tab.

adrian200065 avatar Nov 23 '21 00:11 adrian200065

You can use something like,

$target = get_post_meta($menu_item->ID, 'target', true);

and then target="' . esc_attr($target) . '"> on the <a ... to use self by default but blank if you click it on the menu item setting.

joakim-tldr avatar Aug 19 '23 07:08 joakim-tldr