簡體   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