简体   繁体   English

如何在magento CMS页面中添加共享按钮?

[英]How to add share buttons in magento CMS pages?

我已经在Magento中创建了CMS页面,并且想使用Facebook,Twitter,Google +共享按钮与社交网站共享,所以有人告诉我该怎么做吗?

Add this part to : 将此部分添加到:

your_package/your_theme/template/page/html/head.phtml

before this line --> <?php echo $this->helper('core/js')->getTranslatorScript() ?> 在此行之前-> <?php echo $this->helper('core/js')->getTranslatorScript() ?>

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-c297c92f-9661-1cf3-697d-47c19ab7e281"});</script>

Add this part to your cms page : 将这部分添加到您的cms页面:

<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>

NOTE: using sharethis extension 注意:使用sharethis扩展名

You can check below URL for Addthis button, select style of button you want to share, grab the code and add that code to Magento Admin >> CMS >> Pages. 您可以在URL下方检查“添加此按钮”,选择要共享的按钮样式,获取代码并将该代码添加到Magento管理>> CMS >>页面。 click on to Html view of Editor and paste the code which you have grab from Addthis site, and you will see share buttons on front end. 单击“编辑器”的“ HTML”视图,然后粘贴从Addthis网站获取的代码,您将在前端看到共享按钮。 Another method is you can add this code to your template file commonly used for Example 1column.phtml is used for CMS pages and you need Share buttons on all CMS pages then you can paste the same code in .phtml template file. 另一种方法是,可以将此代码添加到示例1常用的模板文件中。column.phtml用于CMS页面,并且需要在所有CMS页面上使用“共享”按钮,然后可以将相同的代码粘贴到.phtml模板文件中。

Add this : https://www.addthis.com/get/sharing#.UK8_PoafHcc 添加此内容: https : //www.addthis.com/get/sharing#.UK8_PoafHcc

Although this is an old thread i would like to share my answer which i found. 虽然这是一个老话题,但我还是想分享我找到的答案。

  1. Add a meta tag in 在其中添加元标记

template/page/html/head.phtml 模板/页面/html/head.phtml

<meta property="og:site_name" content="yoursite.com"/>
  1. Create a Custom Variable from System/Custom Variables by pasting the Facebook sharing button code to Variable HTML Value . 通过将Facebook共享按钮代码粘贴到Variable HTML Value来从System / Custom Variables创建一个Custom Variable。

  2. To add like/share button to cms or static block, use the “Insert Variable” button to insert the Custom Variable you have just created. 要将“喜欢/共享”按钮添加到cms或静态块,请使用“插入变量”按钮插入刚刚创建的自定义变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM