Plugin này chưa được cập nhật với 3 phiên bản mới nhất của WordPress. Nó có thể không được hỗ trợ và bảo trì, và có thể xung đột với các phiên bản WordPress mới nhất.

Thumbs Rating

Mô tả

I needed a simple and light plugin to add Thumbs Rating, I couldn’t find any so I built my own.

This plugin allows you to add a thumb up/down rating to your content (posts, pages, and custom post types). You can set it up to show anywhere you want, check out the Installation instructions.

The output is very basic, no images, no fonts, no fancy CSS. Customize the ouput overriding the CSS classes in your style.css file.

Chức năng

  • No output printed by default, check the Installation instructions.
  • Lưu giá trị số đánh giá của mỗi nội dung vào bảng bài viết trong CSDL (không cần tạo thêm bảng mới trong CSDL).
  • Uses HTML5 LocalStorage to prevent the users from voting twice.
  • Easy to customize the output using CSS.
  • Show the most voted (positive/negative) items using shortcodes.
  • Show the buttons using shortcodes.
  • No jQuery dependency.

Internet Explorer 11 support

If you want the plugin to work with IE11 users, you need jQuery. For that use the 3.4.2 version of the plugin.

From 4.0.0 onwards the plugin has no dependencies and uses vanilla JavaScript (ES6 syntax). Which will cause it not to work for IE11 users.

Ngôn ngữ

  • Arabic: ar (bởi iFlendra)
  • Catalan: ca
  • Chinese (China): zh_CN (by suifengtec)
  • Czech: cs_CZ (by togur)
  • Danish dk_DK (by BJARNE)
  • Dutch nl_NL (by Thijs)
  • Tiếng Anh
  • French: fr_FR (by Arnaud)
  • German: de_DE (by webserviceXXL)
  • Italian: it_IT (bởi marcochiesi)
  • Japanese: ja (by heySister721)
  • Lithuanian: lt_LT (by Andrius)
  • Persian: fa_IR (by Hamed.T)
  • Portuguese: pt_BR (by Felipe)
  • Polish: pl_PL (by Fafu)
  • Romanian: ro_RO by (by AlexCruz1989)
  • Russian: ru_RU (by anatolt)
  • Serbian: sr_RS (by Andrijana Nikolic)
  • Spanish: es_ES
  • Turkish: tr_TR (by CrimsonIdol)

Give me a hand and translate the plugin in your language, it’s just a few words.

Thỉnh cầu

Feel free to post a request but let’s keep it simple and light.

Ping me

Are you using the plugin? Do you like it? Do you hate it? Let me know!

Ảnh màn hình

  • Basic output with the default CSS with the TwentyThirteen theme.
  • This text is shown if you try to vote again.

Cài đặt

First of all activate the Plugin, then:

A) Add the shortcode to the posts or pages you want the Thumb Rating buttons to appear:

[thumbs-rating-buttons]

B) If you want to show the thumbs after all your content (posts, pages, custom post types) paste this snippet at the end of your functions.php file of your theme:

function thumbs_rating_print($content)
{
  return $content.thumbs_rating_getlink();
}
add_filter('the_content', 'thumbs_rating_print');

C) Alternatively you can print the buttons only in certain parts of your theme. Paste the following snippet wherever you want them to show:

<?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>

Hỏi đáp

I activated the plugin and I don’t see the buttons

You must specify where do you want to show the thumbs within your theme, check out the Installation instructions.

Can I customize the colors?

Chắc chắn rồi. Hãy xem mã CSS nằm trong plugin (thumbs-rating/css/style.css) và ghi đè các class đó ở trong file style.css trong theme của bạn.

When I sort the admin columns some posts disappear

Nếu bài viết/trang có 0 đánh giá ở cột bạn đang cố sắp xếp, WordPress ẩn nó đi.
Hệ thống chỉ hiện bài viết/trang có ít nhất +1 hoặc -1 đánh giá.

How do I show the number of votes in other parts of my theme?

Dán đoạn mã dưới đây vào trong vòng lặp:

<?=function_exists('thumbs_rating_show_up_votes') ? thumbs_rating_show_up_votes() : ''?>

<?=function_exists('thumbs_rating_show_down_votes') ? thumbs_rating_show_down_votes() : ''?>

(Cả hai function trên đều cho phép sử dụng ID bài viết như một thông số trong trường hợp bạn cần)

Can I use the plugin to vote media images?

No, the plugin only works in posts and custom post types.

How do I run code whenever a user votes?

We have an action you can hook into. For instance, if you want to clear your cache.

You can add this to your theme’s functions.php

function example_callback( $post_ID, $type_of_vote, $thumbs_rating_count ) {
    // Place your code here
}
add_action( 'thumbs_rating_vote_action', 'example_callback', 10, 3)

Shortcode

Mã shortcode [thumbs_rating_top] cho phép các thông số dưới đây:

  • type: positive (default) / negative
  • posts_per_page: 5 (default)
  • category: ID (default = all)
  • show_votes: yes (default) / no
  • post_type: any (default) / post / page / books
  • show_both: no (default) / yes
  • order: DESC (mặc định) / ASC
  • orderby: DESC (mặc định)
  • exclude_posts: “133,2,54,234” (ID của các bài viết được ngăn cách bằng dấu phẩy)
  • include_posts: “133,2,54,234” (ID of posts separated by commas)

Đây là cách để sử dụng các thông số:

[thumbs_rating_top type="positive" posts_per_page="10" post_type="post" show_votes="no" order="DESC"]

The shortcode in Widgets or Comments doesn’t work

You might need to allow shortcodes in that sections, here’s how.

Đánh giá

9 Tháng Mười, 2022
I'm so glad I stumbled upon this plugin. Everything works flawlessly, even with a site with 200+ entries directly on a homepage (a timeline). Thank you for this superb plugin Richard. I was really lucky to pick this one when looking around for a good one. I can't share the site because of the rules, but lets just say I'm more than happy with the result 🙂 The code example for clearing cache on vote was useful as well.
6 Tháng Mười, 2022 1 reply
Just the title. Nothing more could be desired, its simplicity is its best feature. Upvotes/Downvotes, pairing this with WPCode plugin you can make it show up on whichever pages you want. Excellent. One thing I am confused about though, is it possible for a user to change their vote? I experimented with it and I can't change my vote. Or I can't figure out how to anyway. This is the only problem that I'm having. Thanks! EDIT: I have now read the existing support like a good boy and realized that there is no method to reset your vote, but that once the cookies are cleared you can vote again. I'm assuming this does not remove the previous vote but allows you to vote multiple times. This is somewhat an issue with me but it is a distant issue. I am trying to use this to rank user submitted content on my site. So letting a user upvote their own content repeatedly (if they learn how to) would be messy.
20 Tháng Một, 2021
This plugin meets up with my expectation. Simple, simple, lightweight,reliable. You cannot looking for more in many aspects.
1 Tháng Hai, 2020 3 replies
Very Simple and useful 🙂 But one question to the develooper: Is it possible to use the buttons several times per page? For example: If I want to do a table with ten rows and each of the row contains content, the user could vote for. So that every button has an individual rating. Currently if i use several buttons in one table (per row), all buttons take the same vote. Is there something to change that? Hope the develooper replies and understood my bad english 😉
2 Tháng Chín, 2019
Hi Thumbs, Thank you for your super lightweight plugin. It works like a charm! No issue whatsoever and Simple and Effective. If able to have the stars symbols would be nice too. We can have options by NUMBERS OR STARS. Then again, with star symbols might pull higher CPU resource? So that's not good after all... I'm not picky overall, it works for me and very nice designed. Giving 5 stars for your plugin. Way2Go!!! Thanks so much for your wonderful job...
17 Tháng Tám, 2019 1 reply
Great little plugin, easy to modify. I was having difficulties making my own function but then I found your plugin. I just changed the text and remove the down vote button. Thanks!
Đọc tất cả 52 đánh giá

Người đóng góp & Lập trình viên

“Thumbs Rating” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

“Thumbs Rating” đã được dịch qua 4 ngôn ngữ. Cảm ơn những người tham gia dịch vì đóng góp của họ.

Dịch “Thumbs Rating” sang ngôn ngữ của bạn.

Muốn tham gia phát triển?

Duyệt code, check out SVN repository, hoặc theo dõi nhật ký phát triển qua RSS.

Nhật ký thay đổi

4.1.0

  • Add a plugin action for those who need a hook from their theme. Documented in the FAQ section.

4.0.3

  • Delete another piece of jQuery code.
  • Read the changelog for the 4.0.2 if you haven’t upgraded to the version 4 yet.

4.0.2

  • Breaking changes! Upgrade with caution.
  • Drop Internet Explorer 11 support.
  • Remove jQuery as a dependency.
  • Uses the ES6 JavaScript syntax.
  • Changed markup to use HTML button’s instead of span.
  • Print the text on the button element instead of relying in CSS.

3.4.2

  • Fixes critial bug with the shortcode not showing results.

3.4.1

  • Fixes critial bug with the shortcode not showing results.

3.4

  • Add include_posts parameter in shortcode.

3.3

  • Add orderby option in shortcode

3.2

  • Add exclude_posts option in shortcode (props @hpd2311)

3.1

  • Author column should not be removed from admin (spotted by sosojni)

3.0

  • Added Arabic translation ar