Hello,
on my site https://datagrafik.de I want to open some of the Links of my Portfolio Items in a new window.
What can I do?
Thanks for Feedback
Bernd
Hi Bernd,
I tried to access using the credentials however it doesn’t work, please check.
Here’s a code you can add in functions.php but we advise putting it in a child theme’s functions.php so the tweak won’t be lost during a theme update.
You can download and find instructions on how to use a child theme here (skip this step if you have one): https://kriesi.at/documentation/enfold/child-theme/
This code will open links in new tab if it’s an external link:
function masonry_links () {
?>
<script>
(function ($) {
$(document).ready (function () {
var url = new RegExp(location.host);
$('.av-masonry-entry').each(function () {
if( ! url.test($(this).attr('href')) ) {
$(this).attr('target', '_blank');
}
});
});
}) (jQuery);
</script>
<?php
}
add_action ('wp_footer', 'masonry_links');
Hope this helps.
Best regards,
Nikko
Hey Nikko!
Exactly what I wanted, phantastic!
Thank you very much
Bernd
Hi Bernd,
We’re glad that we could help :)
Thanks for using Enfold and have a great day!
Best regards,
Nikko