[WordPress] 外掛分享: Post Likerator

首頁外掛目錄 › Post Likerator
10+
安裝啟用
尚無評分
3073 天前
最後更新
問題解決
WordPress 4.8.2+ v1.0.0 上架:2017-10-18

內容簡介

此外掛可讓您在文章、頁面等內容中加入簡單的「讚/取消讚」功能,但沒有「不喜歡」功能。您可以根據自己的主題進行樣式設定,因為此外掛並沒有內建 CSS。此外掛也沒有管理頁面或選項。

使用內嵌的 PHP 函數將「讚」按鈕新增至您的模板:

<?php post_likerator(); ?>

預設會使用當前文章的 ID 並輸出「讚」按鈕的標記。您可以透過傳遞 (整數) 文章 ID 和 (布林值) 輸出引數到函數的方式改變此行為:

<?php $like_button = post_likerator(2501, false); ?>

上述範例會將讚數屬於文章 ID 為 2501 的文章,並將按鈕標記的字串指派給 $like_button 變數而非輸出它。

當設定完成後,點擊按鈕即可按讚,再次點擊可取消按讚。您可以一直來回點擊,但這可能會變得有些無聊。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Post Likerator」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Enables a simple like/unlike feature to be added to posts, pages, etc. There is no dislike feature. You are expected to style it however you like so it matches your theme; it has none of its own CSS. There is also no admin page or options for this plugin.
Add the like button to your template using the included PHP function:

By default it will use the current post ID and echo the like button’s markup. You can change this by passing (integer) Post ID and (boolean) echo arguments to the function:

The above will attribute likes to post ID 2501 and will assign the string of markup to the $like_button variable instead of echoing it.
Once you’ve got it looking awesome, click to like the post. Clicking again will unlike it. You can go back and forth as much as you want, but it will probably get boring after a little while.

延伸相關外掛

文章
Filter
Mastodon