Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Add menu item - Open in same window ?
Gogito
New
Anyway to make the link open in the same window ?
0
Comments
My bad. How to open in different windows ?
you can use a small bit of jquery to do that
here are some examples of what you can do using this , the #Menu a is the one that does it for menu links
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@ vrijvlinder
Unfortunately, I'm stuck. For example: Menu Link No.1 - I would like that when I press on it a new tab will open with google.com
Which code and where do I have to insert it?
Thanks for your help in advance....
you would use children
$('#Menu li:first-child > a').attr("target", '_blank');
$('#Menu li:nth-child(2)> a').attr("target", '_blank');
$('#Menu li:nth-child(3)> a').attr("target", '_blank');
$('#Menu li:last-child > a').attr("target", '_blank');
http://api.jquery.com/nth-child-selector/
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thx for your try to help me. But to be honest. I am not a scripter/coder. I have no idea where to insert this. Can you upload a demo .php file where I can have a look.... with the example www.google.com.
I think than I would understand....
1)
in default.php
change this
public function Base_Render_Before($Sender) {
to this
2)
in the AddMenuItem folder add a subfolder called js
/AddmenuItem/js
create a file in the /AddmenuItem/js/addmenuitem.js
called addmenuitem.js
in addmenuitem.js put this code
since vanilla core does not allow you to add target attributes via addlink, this is the way to do it with this plugin.
otherwise simply add the link with target to your .tpl file.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I made it!
Thx you very very much @peregrine and also @vrijvlinder for your support.
if you want ALL the menu links that were specifically added via with add menu item plugin
you can change the code to this.
$('.sub-menu').attr("target", '_blank');
and all the links that are in the add menu item settings will have external pages.
you also received the Namensgenerator badge
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
title could be change to
Open menu items in a Different Window.
by a moderator.
would make the discussion easier to find.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.