This WordPress plugin is coming soon! You can see it in action on our blog!
Here’s some of the code features:
- Vanilla JavaScript (ES6) with event delegation for faster script evaluation
- PHP 7+ compatibility
- Eficient and performant code
There are several WordPress reactions plugins, but nothing up to date (I found 4 or 5 not updated for at least one year) or lightweight.
Tutorials
How to display reactions in the loop:
<?php
// Sample loop and arguments
$args = [
'post_status' => 'publish',
'post_type' => 'post',
'posts_per_page' => 18
];
$blogQuery = new WP_Query($args);
$data = '';
if ($blogQuery->have_posts()) {
while ($blogQuery->have_posts()) {
$blogQuery->the_post();
$postID = get_the_ID();
if (function_exists('article_reactions') && (int) get_post_meta($postID, 'article_reaction_total_liked', true) > 0) {
$data .= get_post_meta($postID, 'article_reaction_total_liked', true) . ' reactions | ';
}
}
}
return $data;