Below, you’ll find a detailed guide on how to add the Posts Like Dislike Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Posts Like Dislike Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Posts Like Dislike Plugin and the shortcodes it provides:
"Posts Like Dislike is a dynamic WordPress plugin that seamlessly enables users to express their opinions on your content through a simple, interactive like or dislike system."
- [posts_like_dislike]
Posts Like Dislike [posts_like_dislike] Shortcode
The ‘posts_like_dislike’ shortcode is a function that allows users to display a like-dislike feature on their posts. It renders the shortcode by including the ‘like-dislike-render.php’ file.
Shortcode: [posts_like_dislike]
Examples and Usage
Basic example – Show the like and dislike buttons for a specific post by using the post’s ID.
[posts_like_dislike id=1 /]
PHP Function Code
In case you have difficulties debugging what causing issues with [posts_like_dislike]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('posts_like_dislike', array($this, 'render_pld_shortcode'));
Shortcode PHP function:
function render_pld_shortcode($atts)
{
$content = '';
$shortcode = true;
include(PLD_PATH . '/inc/cores/like-dislike-render.php');
return $content;
}
Code file location:
posts-like-dislike/posts-like-dislike/inc/classes/pld-hook.php
Conclusion
Now that you’ve learned how to embed the Posts Like Dislike Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply