Social media - Add a Twitter button to your blog

TyW
Community Manager
Community Manager
576 35 863

If your theme does not include a Twitter button and you want to add one, then you will need to edit your theme. Contact the designer of your theme if you're not sure if your theme already includes a Twitter button – chances are, there is a theme setting to add Tweet buttons to your blog.

 

If your theme doesn't have that feature:

 

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Actions > Edit code.
  3. Under the Templates folder, locate and click article.liquid and blog.liquid to open them in the online code editor.

    twitterbutton01.jpg

  4. In blog.liquid and article.liquid—both templates will need to be edited in the same way—look for this code:

    {{ article.content }}

     

  5. Above the element that outputs the article content, paste the following code:


    <script src="https://platform.twitter.com/widgets.js" type="text/javascript"></script>
      <div>
        <a href="https://twitter.com/share" class="twitter-share-button"
          data-url="{{ shop.url }}{{ article.url }}"
    data-via="your_screen_name" data-text="{{ article.title | escape }}"
    data-count="horizontal">Tweet</a> </div>

     

  6. Replace your_screen_name with your Twitter account alias, without the @. For example, Shopify's twitter account name is shopify.
  7. Save your changes.

Repeat the above procedure for both templates.

TyW | Online Community Manager @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes