Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav Menu Open Link in a new tab does not work #72

Open
adrian200065 opened this issue Nov 23, 2021 · 1 comment
Open

Nav Menu Open Link in a new tab does not work #72

adrian200065 opened this issue Nov 23, 2021 · 1 comment

Comments

@adrian200065
Copy link

adrian200065 commented Nov 23, 2021

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.

@joakim-tldr
Copy link

joakim-tldr commented Aug 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants