[WordPress] 外掛分享: Ruven Themes: Sharing Links

首頁外掛目錄 › Ruven Themes: Sharing Links
20+
安裝啟用
★★★★
4.5/5 分(2 則評價)
4214 天前
最後更新
問題解決
WordPress 3.5.0+ v1.1 上架:2014-05-20

內容簡介

這個外掛提供一個功能,可以輸出連結以分享文章至 Facebook、Twitter 和 Google+。

在 Ruven 選定的佈景主題啟用外掛時,連結會自動顯示。
在其他主題中,您需要編輯主題中的模板以輸出這些連結。

以下是輸出連結為列表的範例:

<?php
if(function_exists('ruven_sharing_links')) {
echo '<ul class="sharing-list">';
$sharing_links = ruven_sharing_links();
foreach($sharing_links as $sharing_link) {
echo "<li>$sharing_link</li>";
}
echo '</ul>';
}
?>

用法
$sharing_links = ruven_sharing_links( $get_array, $include, $open_in_new_tab, $class );

參數

$get_array
(bool) (可選) 如果您想讓返回值為關聯陣列(標題、URL)或 HTML 連結陣列,請設置為 true。通過獲得關聯陣列,您可以進一步自定義輸出。

預設值:false

$include
(array) (可選) 如果您不想要包含所有平台(Facebook、Twitter 和 Google+),您可以在此指定要返回的特定平台。例如 array('Twitter', 'Facebook') 僅返回 Twitter 和 Facebook 連結。

預設值:array()

$open_in_new_tab
(bool) (可選) 如果您希望在新標籤/視窗中打開分享對話框,請設置為 true。

預設值:true

$class
(array) (可選) 您想要添加到連結中的類。例如 array('sharing-button', 'big-button')

預設值:array()

返回值

如果 $get_array 的值為 false(預設值),則該函式會返回 HTML 連結陣列。

如果 $get_array 的值為 true,則該函式會返回標題(例如“Twitter”)和分享文章的 URL 的關聯陣列。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Ruven Themes: Sharing Links」→ 直接安裝(推薦)

原文外掛簡介

This plugin provides a function to output links to share a post to Facebook, Twitter, and Google+.
Selected themes by Ruven will display the links automatically when the plugin is activated.
In other themes you will have to edit the templates in your theme in order to output the links.
Here an example of outputting the links in as list:
';
$sharing_links = ruven_sharing_links();
foreach($sharing_links as $sharing_link) {
echo "

  • $sharing_link
  • ";
    }
    echo '

    ';
    }
    ?>

    Usage
    $sharing_links = ruven_sharing_links( $get_array, $include, $open_in_new_tab, $class );

    Parameters
    $get_array
    (bool) (optional) If you want the return value to be an associative array (title, URL) or an array of HTML links. By getting an associative array, you are able to customize the output more.
    Default: false
    $include
    (array) (optional) If you don’t want all platforms (Facebook, Twitter, and Google+) included, you can specify here which you want specifically to be returned. E.g. array('Twitter', 'Facebook') would only return Twitter and Facebook links.
    Default: array()
    $open_in_new_tab
    (bool) (optional) If you want the sharing dialog to be opened in a new tab/window or not.
    Default: true
    $class
    (array) (optional) Classes you want to add to the links. E.g. array('sharing-button', 'big-button')
    Default: array()
    Return Value
    If the value of $get_array is false (default), the function returns an array of HTML links.
    If the value of $get_array is true, the function returns an associative array of the title (e.g. “Twitter”) and the URL to share the post.

    延伸相關外掛

    文章
    Filter
    Apply Filters
    Mastodon