CleverCreativeMavericks Posted April 10, 2023 Posted April 10, 2023 Hi there, I am using the linking Post Title to Source URL and want the blog post title links to open in the same tab. I tried to used this code but understand it makes all external link open in the same tab: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(document).ready(function() { $('a').attr('target','_self'); }); </script> However, I would like to keep the social links and the About link to open in a new tab. Is there a way to open only blog post links in the same tab and keep social links and About link open in a new tab?
tuanphan Posted April 11, 2023 Posted April 11, 2023 Change _self to _blank If you want this Is there a way to open only blog post links in the same tab and keep social links and About link open in a new tab? please share link to your site, we can check easier Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
CleverCreativeMavericks Posted April 11, 2023 Author Posted April 11, 2023 8 hours ago, tuanphan said: Change _self to _blank If you want this Is there a way to open only blog post links in the same tab and keep social links and About link open in a new tab? please share link to your site, we can check easier Thank you, this is the site link: https://www.cleverbranded.com I changed the code from _self to _blank, which allowed the About & Social links to open in a new tab but when I click on the project titles, it opens them in a new tab which is something I want to avoid. Is that possible?
tuanphan Posted April 16, 2023 Posted April 16, 2023 On 4/12/2023 at 12:25 AM, CleverCreativeMavericks said: Thank you, this is the site link: https://www.cleverbranded.com I changed the code from _self to _blank, which allowed the About & Social links to open in a new tab but when I click on the project titles, it opens them in a new tab which is something I want to avoid. Is that possible? Use this code <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(document).ready(function() { $('a:not(.passthrough-link)').attr('target','_blank'); }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
tonyflores Posted September 18, 2023 Posted September 18, 2023 This script worked for me to only target the Source Title links: <script> $(document).ready(function() { $('a.passthrough-link').attr('target', '_self'); }); </script> tuanphan 1
Katy_MF Posted November 23, 2023 Posted November 23, 2023 Hello, I have a similar problem - I'm happy with certain blogs opening in a new tab, but the blogs that I'm pulling through from a summary block on our homepage. Should there not be some sort of toggle to enable this for blogs - whether that's on an individual or just blogs in general basis. I'm not a huge coder so hoping I can find a manageable work around. All help greatly appreciated! Thanks!
tuanphan Posted November 24, 2023 Posted November 24, 2023 18 hours ago, Katy_MF said: Hello, I have a similar problem - I'm happy with certain blogs opening in a new tab, but the blogs that I'm pulling through from a summary block on our homepage. Should there not be some sort of toggle to enable this for blogs - whether that's on an individual or just blogs in general basis. I'm not a huge coder so hoping I can find a manageable work around. All help greatly appreciated! Thanks! Can you share link to page where you have problem? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment