How can we configure Shapely (or the CSS or else) so that the links inside the widgets are opened in a new tab?
We cannot put the target="_blank" in the widget field and I think NOBODY would like a visitor to click on a client’s link (or even on our social media icons) and LEAVE our website!
Is there a (simple or less simple) way?
Thank you very much
Sorry for a late in response, you can do this,
- Install any plugin that supports adding custom js to the theme, say Custom JS – WordPress plugin | WordPress.org
- Add this script,
jQuery('.soc-ico a').attr('target', '_blank');
and change the
.soc-ico a selector according to your needs, if you’re trouble finding the selector please pass me the website address and give me which links you want to open in a new tab, so that I can alter the selector for you!
Let us know,
I have been having the same problem. I installed a plugin for custom JS as suggested, and added that script, but it is not working?
There is also no option to change the .soc-ico a selector? What does that mean exactly?
@laranz I’m having a similar problem. I have 2 buttons I would like to open their respective links into a new tab. The site is https://20dayagilitychallenge.org/. I think the 1st button’s selector is “btn btn-lg btn-white” and the 2nd button’s selector is “btn btn-lg btn-filled”. Both buttons have the text of “take the 20-day agility challenge”.
It tried the following using the Simple Custom CSS & JS plug-in:
jQuery(’.btn btn-lg btn-white a’).attr(‘target’, ‘_blank’);
jQuery(’.btn btn-lg btn-filled a’).attr(‘target’, ‘_blank’);
but it doesn’t work so I must not quite have the correct selectors.
Can you help me sort out what I’ve missing?
Hey, I just tried your website and it worked nice for me, links are opening in the new window
It’s still not working for me on a Mac with either Chrome or Safari.
How can I resolve what’s going on to ensure it works for everyone?
There is no reason for it to not work in the browsers, check this out: Screenshot by Lightshot as you can see HTML tags are correct, there is nothing that needs to be fixed now,
if you still think you have a problem you may need to contact Jetpckak since these social links are made by the plugin