Social links open in a new page

Solved

Social links open in a new page

Daniel19901
Shopify Partner
244 0 65

Hi everyone, I don't have this option in my theme, but I would like the social links to be opened in a new tab, can anyone help ? 🙂

https://www.ildetailing.com/

Accepted Solution (1)
BSSCommerce-HDL
Shopify Partner
2292 842 1057

This is an accepted solution.

@Daniel19901, You can try with this code: 

<script>
let social_links = document.querySelectorAll('.hdt-socials__list .hdt-socials__item.hdt-inline-block a');
if(social_links.length > 0) {
   social_links.forEach(link => {
     link.setAttribute('target', '_blank');
   });
}
</script>

Hope this can help you 😍

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

View solution in original post

Replies 4 (4)

BSSCommerce-HDL
Shopify Partner
2292 842 1057

Hi @Daniel19901

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </body> tag:

 

 

<script>
let social_links = document.querySelectorAll('.hdt-socials__list .hdt-socials__item.hdt-inline-block');
if(social_links.length > 0) {
   social_links.forEach(link => {
     link.setAttribute('target', '_blank');
   });
}
</script>

 

 

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you  😍

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

Daniel19901
Shopify Partner
244 0 65

@BSSCommerce-HDL thx, but it didn't work 😞

BSSCommerce-HDL
Shopify Partner
2292 842 1057

This is an accepted solution.

@Daniel19901, You can try with this code: 

<script>
let social_links = document.querySelectorAll('.hdt-socials__list .hdt-socials__item.hdt-inline-block a');
if(social_links.length > 0) {
   social_links.forEach(link => {
     link.setAttribute('target', '_blank');
   });
}
</script>

Hope this can help you 😍

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

Chinookie88
Visitor
1 0 0

Hello, 

I am interested in doing the same thing for my site: Chinook Footwear – Chinook® Footwear
But I cannot get the code string to work. I've embedded the code string in the position suggested but it doesn't seem to work for me.