繁体   English   中英

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

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

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

将此部分添加到:

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

在此行之前-> <?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>

将这部分添加到您的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>

注意:使用sharethis扩展名

您可以在URL下方检查“添加此按钮”,选择要共享的按钮样式,获取代码并将该代码添加到Magento管理>> CMS >>页面。 单击“编辑器”的“ HTML”视图,然后粘贴从Addthis网站获取的代码,您将在前端看到共享按钮。 另一种方法是,可以将此代码添加到示例1常用的模板文件中。column.phtml用于CMS页面,并且需要在所有CMS页面上使用“共享”按钮,然后可以将相同的代码粘贴到.phtml模板文件中。

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

虽然这是一个老话题,但我还是想分享我找到的答案。

  1. 在其中添加元标记

模板/页面/html/head.phtml

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

  2. 要将“喜欢/共享”按钮添加到cms或静态块,请使用“插入变量”按钮插入刚刚创建的自定义变量。

暂无
暂无

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

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