Tagged: x
-
AuthorPosts
-
February 16, 2017 at 11:55 am #1373857
NaturalifeParticipantHello,
I was wondering if there was any way to open all external links in a new tab using this theme.
Any help would be hugely appreciated.
Thank you so much.
website: http://naturalife.org
February 16, 2017 at 2:22 pm #1374021
RahulModeratorHi There,
Thanks for writing in!
To open posts in a new tab automatically, please add the following JS code in the customizer, Appearance > Customize > Custom > Javascript:
(function($){ $('.entry-title a').attr('target', '_blank'); })(jQuery);Let us know how it goes.
Thanks.
March 1, 2017 at 7:41 pm #1391246
NaturalifeParticipantWorked like a charm! Thank you
March 1, 2017 at 10:26 pm #1391388
Prasant RaiModeratorYou are most welcome. 🙂
March 10, 2017 at 10:26 am #1402048
TimParticipantThe solution above did not work for me, but I found the following snippet, which worked perfectly:
/*Open all external links in a new window*/ jQuery(document).ready(function($) { $('a').not('[href*="mailto:"]').each(function () { var isInternalLink = new RegExp('/' + window.location.host + '/'); if ( ! isInternalLink.test(this.href) ) { $(this).attr('target', '_blank'); } }); });Sharing so that it might help someone else.
March 10, 2017 at 11:53 am #1402140
JoaoModeratorHi Timothy,
Thanks for your input for the community.
Cheers
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1373857 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
