-
AuthorPosts
-
May 11, 2021 at 8:07 am #1299586
Hi everyone,
I have already set a link target (_blank) for a menu item. In the main menu on the top this already works perfectly.
However, when I am on a page of the submenu, the submenu is also displayed again on the right. There my link target is ignored and every link opens in the same window. How can I change this?May 12, 2021 at 7:03 am #1299838Hey GrandmasterA,
I’m not sure exactly what you are referring to, is it a widget in a sidebar maybe? If so, then how did you create the widget?
Best regards,
RikardMay 12, 2021 at 7:09 am #1299842Hi.
no, this menu is included in the Enfold theme. You can find it in the settings for the sidebar. In the German version, it is called “Seitenleiste mit Seiten-Navigation”, so it is probably called “Sidebar with page navigation” in the English version.
This menu ignores the link target, which is set in the menu settings, so it is probably a problem of the Enfold theme… The main menu works great on the other hand.May 12, 2021 at 11:25 am #1299886Hi GrandmasterA,
Can you give us a link to the page where the submenu you’re referring is shown?
Best regards,
NikkoMay 12, 2021 at 11:30 am #1299887The website is not public yet, so i put the data in the private content field.
May 13, 2021 at 7:42 am #1300042Hi GrandmasterA,
Thanks for providing us with the link and I tried to reproduce it on my end Navigation Menu widget however I could not reproduce the issue on my end.
Can you give us temporary admin access? so we can try to inspect the backend. If you can setup a staging site for us, it would be better so we can try to troubleshoot the issue without affecting your live site. Here’s a simple tutorial you can follow: https://themeisle.com/blog/wordpress-staging-site/Best regards,
NikkoMay 17, 2021 at 8:07 am #1300656Hi,
sorry for my late response, but we had a holiday on Thursday and Friday in Germany.
To reproduce it, simply add a target to a menu point as described here:
https://kriesi.at/support/topic/adding-_blank-to-main-menu-custom-link/This adds the target to the main menu, just as wanted.
The menu on the right side is part of the Enfold theme. It’s not a third party widget.
You can find it in the Enfold “Sidebar settings”. It is called “Page sidebar navigation”. There’s a simple checkbox to add it or not.
See screenshot: https://i.ibb.co/TRV7BVQ/sidebar.jpgThe problem is: this menu ignores the target settings from above, while the main menu doesn’t…
Main menu:
<li id="menu-item-954" class="menu-item menu-item-type-post_type menu-item-object-page"><a target="_blank" href="http://neu.cismst.de/en/cis-ev/charter/" itemprop="url"><span class="avia-bullet"></span><span class="avia-menu-text">Charter (PDF)</span></a></li>
Sidebar menu:
<li class="page_item page-item-920"><a href="http://neu.cismst.de/en/cis-ev/charter/">Charter (PDF)</a></li>
May 18, 2021 at 3:12 pm #1301001Hi GrandmasterA,
No worries, also I tried to reproduce the issue using the following steps:
1. Go to Appearance > Menus, created a menu with some of the menu items are set to open in a new tab.
2. In Enfold > Sidebar Settings, Page Sidebar navigation is enabled and set to Right Sidebar
3. Go to Appearance > Widgets > Displayed Everywhere, added a Navigation Menu which the selected menu is the one I created in Step 1.
4. Checked in one of the pages where the sidebar appears (similar to the link in private content) but on my end, the menu items set to open in the new tab worked properly however on the link you gave it does not. This is why I mentioned I could not reproduce the issue on my end.
I’m not really sure what is causing the issue on your end, probably a plugin, a custom code, or maybe some settings that produce that bug you have on your end, however, it’s pretty hard to pinpoint what’s the cause of the issue since everything is working properly on my end, so we would need to try to troubleshoot it on a setup that has the issue. Since your site is probably live, we would like to ask if you can provide a staging site.Best regards,
NikkoMay 19, 2021 at 7:55 am #1301146Hi Nikko,
I just realized, that all changes to my menu don’t have any impact on my sub menu (the main menu is working!). Even when I change link names or add a custom link or change the link order, the sub menu stays the same. So maybe this is the problem. I have no idea, where the sub menu comes from and why changes are ignored. Is there a cache for the menu or something like this?
I’ll give you access to my existing website, since it’s not live yet… Maybe you’ll find a solution.
Thanks a lot for your effort!May 21, 2021 at 4:59 am #1301504Hi GrandmasterA,
Thanks for giving us admin access.
I have checked on it and my assumptions on how it was setup was wrong and the sidebar navigation was generated by Enfold and it cannot be changed via Appearance > Menus.
I have add this code at the bottom of functions.php:function open_in_newtab(){ ?> <script> document.querySelector("#top .widget .page-item-920 > a").setAttribute("target", "_blank"); </script> <?php } add_action('wp_footer', 'open_in_newtab');
However, this is not a good practice, because a theme update would wipe the code.
I would suggest using a child theme which you can download and find instructions in https://kriesi.at/documentation/enfold/child-theme/
Then move the code out of the parent theme and place it in the child theme.Best regards,
NikkoMay 21, 2021 at 8:07 am #1301543Thanks for the code. I don’t really like workarounds like this, but it’s better than nothing.
“the sidebar navigation was generated by Enfold and it cannot be changed via Appearance > Menus”
I don’t really get, where it is generated and how it can be updated. The sidebar navigation was clearly generated after my settings in “Appearance > Menus”. It also has the same order as selected in “Appearance > Menus”. But now, when I add new menu items or change the order, the sidebar menu ignores these changes. I don’t really get, why… And as far as I am aware, it worked before I made two updates for Enfold in March and April. Maybe something was changed there?
As an example, I added “Annual reports” to the menu in http://neu.cismst.de/en/cis-ev/association/
It appears in the main menu, but not in the sidebar menu.May 27, 2021 at 4:37 am #1302490Hi GrandmasterA,
I apologize for the delayed response.
I could not find the correct menu for that page in Appearance > Menus (the only option I see is Footer Deutsch, Footer English, Hauptmenu Deutsch, Hauptmenu English).
If I checked Appearance > Widgets > Sidebar Pages there’s no Navigation Widget in there and that’s why I believe this function is triggered avia_sidebar_menu (in functions-enfold.php line 1725-1775 of Enfold 4.8.2) and it only displays its sibling pages.
To add Annual Reports to the sidebar in the link you gave, you’ll need to set Annual Report’s parent page to CiS eV.Best regards,
NikkoMay 27, 2021 at 7:49 am #1302541Ah, I see…
So at least, I know now, that there is nothing wrong with my system and I’ll keep the workaround for now. This thread can be closed then.Thanks a lot for taking the time to find out! :)
Best regards,
AndreasMay 27, 2021 at 8:48 am #1302551Hi Andreas,
You’re welcome :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Menu link target in submenu’ is closed to new replies.