Social media links to open in new window

Highlighted
Tourist
9 0 4

Hi, 

I'm using the Shopify theme Supply. I'd like my social media links in the footer to open in a new window rather than navigate away from my shop, could some kind soul let me know how to do this please?

Thanks 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
242 1 20

Hi Graham

If you open the theme.liquid file and find the line that says

{% if settings.footer_social_enable %}

Then, you will see a lot of code under it for each social icon. Each section will have something like the line below, this line is for twitter, others will look similar but will be facebook, pinterest etc.

<a class="icon-fallback-text" href="{{ settings.social_twitter_link }}" title="{{ 'layout.footer.store_on_social_network' | t: store_name: shop.name, social_network: 'Twitter' | escape }}">

After the part that says {{ settings.social_twitter_link }}" the following.

target="_blank"

make sure it's before the part that says title="

Do that for each one and they'll open in new windows.

-Shawn R.
Shopify Guru

2 Likes
Highlighted
Astronaut
1890 1 442

Another way is to use some Javascript.

In theme.liquid, before </body> at the end of the file, insert:

  <script>
    jQuery('.social-icons a').attr('target', '_blank');
  </script>

 

3 Likes
Highlighted
Tourist
9 0 4

Great thanks guys.  Will sort that in the morning

 

Must remember to back up first, 

Must remember to back up first

Must remember....... 

1 Like
Highlighted
New Member
1 0 0

hi ive had a look cant seem to find the code

0 Likes